Difference between revisions of "MOR API did device assign"

From Kolmisoft Wiki
Jump to navigationJump to search
(Created page with 'MOR API DID assign Device <br><br> ---- <br><br> * Call: /api/did_assign_device * Methods: POST, GET(if allowed, not recomended) * Params: ** did - DID number to be created '…')
 
 
(13 intermediate revisions by 6 users not shown)
Line 1: Line 1:
[[MOR API]]
=Descriptiom=
DID assign Device
[[MOR API]] DID assign Device
<br><br>
<br><br>
----
=Usage=
 
* From '''MOR X4''' call: '''/api/did_device_assign'''
* For Backwards-compatibility old name 'did_assignt_device' is also usable. Call: '''/api/did_assign_device'''
* Methods: POST, GET(if allowed, not recommend)
 
<br><br>
===Parameters===
 
Parameters which are '''included''' into hash:
 
* device_id - Device ID in MOR database, to be assigned for specified DID '''Required'''.
* did - DID number to which device have to be assigned. '''Required'''.
 
 
Parameters which are '''not included''' into hash:
 
* u - username for authentication. '''Required'''.
* [[MOR API hash construction | hash]] - SHA1 hash constructed using '''params''' and '''API_Secret_Key''' ([[MOR API hash construction | More described in Constructing hash]]). '''Required'''.
<br><br>
<br><br>
* Call: /api/did_assign_device
 
* Methods: POST, GET(if allowed, not recomended)
===Request===
* Params:
 
** did - DID number to be created '''Required'''.
We have device_id = 1, did=123456789, API Secret Key = secret
** device_id - Device ID in MOR database, to be assigned for specified DID '''Required'''.
 
** u - username to login. '''Required'''.
We send
** p - password to login. '''Required'''.
 
** [[MOR API hash construction | hash]] - SHA1 hash constructed using '''params''' and '''API_Secret_Key''' ([[MOR API hash construction | More described in Constructing hash]]). '''Required'''.
HTML POST: http://<SERVER_IP>/billing/api/did_device_assign?u=username&did=123456789&device_id=1&hash=bc2f114099d16656d37e45fd9e8744cb9386d462
* Returns:
 
**Success
Now we can view these changes in GUI through DID edit.
*** <status>Device assigned to DID</status>
 
** Errors:
'''NOTE that username and password are not included in hash'''
*** <error>Incorrect hash</error> - Hash was not correct. Check API_Secret_Key and order or params while concatenating hash_string.
 
*** <error>Don't be so smart</error> - Only Admin, Accountant or Reseller may use API.
'''NOTE''' if you want to assign DID to Reseller's User Device, then reserve DID to Reseller first by using [[MOR_API_did_details_update]] and after that use did_device_assign with u=<reseller username>.
*** <error>Device was not found</error> - Enter existing Device ID.
*** <error>Your are not authorized to use this Device</error> - Specified Device is not available to this user.
*** <error>You are not authorized to manage DIDs</error> - If Accountant or Reseller is using API, they should have all permissions to perform specified actions.
*** <error>DID does not exist</error> - Enter existing DID number.
*** <error>Invalid DID specified</error> - Enter a valid (numeric) DID number.
*** <error>Your are not authorized to use this DID</error> - Specified DID is not available to this user.
*** <error>DID is terminated</error> - DID is terminated and cannot be used.
*** <error>DID is not free</error> - DID is being used in a Dial Plan or another Device is already assigned.
*** <error>Device was not assigned</error>
<br><br>
<br><br>
== Request ==


http://123.123.123.123/billing/api/device_create/u=admin&p=password&did=123456789&device_id=1&hash=bc2f114099d16656d37e45fd9e8744cb9386d462
===Returns===


*admin - owner's username
'''Success'''
*password - owner's password
 
*did - DID number
<?xml version="1.0" encoding="UTF-8"?>
*device_id - Device ID in MOR database, to be assigned for specified DID
<page>
    <status>
      <success>Device assigned to DID</success>
    </status>
</page>
<br><br>
<br><br>
----
----
*Example:
**We have device_id = 1, API Secret Key = secret
**Converted Hash string like "bc2f114099d16656d37e45fd9e8744cb9386d462"
*We send:
**http://123.123.123.123/billing/api/device_create/u=admin&p=password&did=123456789&device_id=1&hash=bc2f114099d16656d37e45fd9e8744cb9386d462
*We get:


            <page>
'''Errors'''
                  <status>Device assigned to DID</status>
            </page>


*We send:
<?xml version="1.0" encoding="UTF-8"?>
**http://123.123.123.123/billing/api/device_create/u=admin&p=password&did=123456790&device_id=1&hash=bc2f114099d16656d37e45fd9e8744cb9386d462
<page>
*We get:
    <status>
      <error>Error message</error>
    </status>
</page>


            <page>
Error messages:
                  <status>Device assigned to DID</status>
            </page>


*Now we can view these changes in GUI through DID edit.
* Incorrect hash – Hash was not correct. Check API_Secret_Key and order or params while concatenating hash_string.
* Access Denied – Only Admin, Accountant or Reseller may use API.
* Device was not found – Device ID does not exist in system.
* DID was not found – DID number does not exist or incorrect.
* Your are not authorized to use this Device – Specified Device is not available to this user.
* You are not authorized to manage DIDs – If Accountant or Reseller is using API, they should have all permissions to perform specified actions.
* Your are not authorized to use this DID – Specified DID is not available to this user.
* DID is terminated – DID is terminated and cannot be used.
* DID is not free – DID is being used in a Dial Plan or another Device is already assigned.
* Device was not assigned – unknown error
 
 
<br><br>


'''* Note that username and password are not included in hash'''
=See also=
* [[MOR API did trunk device assign]]
* [[MOR API]]

Latest revision as of 05:38, 21 May 2018

Descriptiom

MOR API DID assign Device

Usage

  • From MOR X4 call: /api/did_device_assign
  • For Backwards-compatibility old name 'did_assignt_device' is also usable. Call: /api/did_assign_device
  • Methods: POST, GET(if allowed, not recommend)



Parameters

Parameters which are included into hash:

  • device_id - Device ID in MOR database, to be assigned for specified DID Required.
  • did - DID number to which device have to be assigned. Required.


Parameters which are not included into hash:



Request

We have device_id = 1, did=123456789, API Secret Key = secret

We send

HTML POST: http://<SERVER_IP>/billing/api/did_device_assign?u=username&did=123456789&device_id=1&hash=bc2f114099d16656d37e45fd9e8744cb9386d462

Now we can view these changes in GUI through DID edit.

NOTE that username and password are not included in hash

NOTE if you want to assign DID to Reseller's User Device, then reserve DID to Reseller first by using MOR_API_did_details_update and after that use did_device_assign with u=<reseller username>.

Returns

Success

<?xml version="1.0" encoding="UTF-8"?>
<page>
   <status>
      <success>Device assigned to DID</success>
   </status>
</page>




Errors

<?xml version="1.0" encoding="UTF-8"?>
<page>
   <status>
      <error>Error message</error>
   </status>
</page>

Error messages:

  • Incorrect hash – Hash was not correct. Check API_Secret_Key and order or params while concatenating hash_string.
  • Access Denied – Only Admin, Accountant or Reseller may use API.
  • Device was not found – Device ID does not exist in system.
  • DID was not found – DID number does not exist or incorrect.
  • Your are not authorized to use this Device – Specified Device is not available to this user.
  • You are not authorized to manage DIDs – If Accountant or Reseller is using API, they should have all permissions to perform specified actions.
  • Your are not authorized to use this DID – Specified DID is not available to this user.
  • DID is terminated – DID is terminated and cannot be used.
  • DID is not free – DID is being used in a Dial Plan or another Device is already assigned.
  • Device was not assigned – unknown error




See also