Difference between revisions of "MOR API device create"

From Kolmisoft Wiki
Jump to navigationJump to search
(Created page with '''This functionality is available from MOR 11'' MOR API Create device <br><br> ---- <br><br> * Call: /api/device_create * Methods: POST, GET(if…')
 
 
(34 intermediate revisions by 8 users not shown)
Line 1: Line 1:
''This functionality is available from [[MOR 11 documentation | MOR 11]]''
=Description=
[[MOR API]] Create Device
<br><br>


=Usage=


[[MOR API]]
* Call: /api/device_create
Create device
* Methods: POST, GET(if allowed, not recomended)
<br><br>
===Parameters===


Parameters which are '''included''' into hash:
* user_id - User ID in MOR database, for which user device should be created. '''Required'''.
* description - string
* pin - [number. '']. If pin param not send -> random_numbers . If blank -> pinless
* type - Device type [SIP, IAX2, FAX, Virtual,H323, ZAP, Skype, '']. When is '' -> default device type. If default device type is empty -> 'SIP'
* devicegroup_id - device group ID
* caller_id - CallerID
'''Note that parameters are shown in the same order as they have to be when generating the hash. Last parameter in a row is API_Secret_Key'''
<br><br>
Parameters which are '''not included''' into hash:
* '''[[MOR API hash construction | hash]]''' - SHA1 hash constructed using '''parameters''' which are listed above. Note that parameters are shown in the same order as they have to be when generating the hash. Last parameter in a row is '''API_Secret_Key''' ([[MOR API hash construction | More described in Constructing hash]]). '''Required'''.<br>
* '''u''' - username for authentication. '''Required'''.
* '''extension''' - Device Extension.
* '''fromuser''' - sets value for Fromuser.
* '''call_timeout''' - max call duration (in seconds).
* '''language''' - sets value for language.
<br><br>
===Request===
We have user_id = 2, API Secret Key = secret
We send:
HTML POST: http://<SERVER_IP>/billing/api/device_create?u=admin&user_id=2&description=desription1&pin=3&hash=6e79d4a82f68102f43be11d873177f47817f84df
*Now we can find these Devices in GUI Devices list.
'''* Note that username and password are not included in hash'''
<br><br>
===Returns===
'''Success'''
<?xml version="1.0" encoding="UTF-8"?>
<page>
  <status>Device created</status>
  <id>id of new device</id>
  <username>username of new device</username>
  <password>password of new device</password>
</page>
<br><br>
<br><br>
----
----
'''Errors'''
* <error>User was not found</error> - User was not found using user_id. Use correct user id.
* <error>Incorrect hash</error> - Hash was not correct. Check API_Secret_Key and order or params while concatenating hash_string.
* <error>Dont be so smart</error> - User with UNIQUEHASH not found or params id not send. Enter correct id.
* <error>Device type invalid</error> - Enter correct type.
* <error>Device group invalid</error> - Device group with id not found. Enter group id.
* <error>Pin is already used</error> - Enter onother pin.
* <error>Pin must be numeric</error> - Enter correct pin.
* <error>You are not authorized to manage callerid</error> - User does not have permissions to manage CallerID option.
* <error>Device was not created</error>
** <message>problem message</message>
Example:
<?xml version="1.0" encoding="UTF-8"?>
<page>
  <error>Error message</error>
</page>
<br><br>
<br><br>


* Call: /api/device_create
=See also=
* Methods: POST, GET(if allowed, not recomended)
 
* Params:
* [[MOR API]]
** user_id - User ID in MOR database, whose datas we want to delete. '''Required'''.
** u - username to login. '''Required'''.
** p - password to login. '''Required'''.
** hash - 632667547e7cd3e0466547863e1207a8c0c0c549
** description - string
** pin - [number. '']. If '' -> random_numbers
** type - Device type [SIP, IAX2, FAX, Virtual,H323, ZAP, Skype, '']. When is '' -> default device type. If default device type is empty -> 'SIP'
** devicegroup_id - device group ID
**
* Returns:
**Success
*** <status>Device was created</status>
** Errors:
*** <error>User was not found</error> - User was not found using user_id. Use correct user id.
*** <error>Incorrect hash</error> - Hash was not correct. Check API_Secret_Key and order or params while concatenating hash_string.
*** <error>Dont be so smart</error> - User with UNIQUEHASH not found or params id not send. Enter correct id.
*** <error>Device was not created</error>
**** <message>problem message</message>

Latest revision as of 10:08, 27 June 2017

Description

MOR API Create Device

Usage

  • Call: /api/device_create
  • Methods: POST, GET(if allowed, not recomended)



Parameters

Parameters which are included into hash:

  • user_id - User ID in MOR database, for which user device should be created. Required.
  • description - string
  • pin - [number. ]. If pin param not send -> random_numbers . If blank -> pinless
  • type - Device type [SIP, IAX2, FAX, Virtual,H323, ZAP, Skype, ]. When is -> default device type. If default device type is empty -> 'SIP'
  • devicegroup_id - device group ID
  • caller_id - CallerID

Note that parameters are shown in the same order as they have to be when generating the hash. Last parameter in a row is API_Secret_Key

Parameters which are not included into hash:

  • hash - SHA1 hash constructed using parameters which are listed above. Note that parameters are shown in the same order as they have to be when generating the hash. Last parameter in a row is API_Secret_Key ( More described in Constructing hash). Required.
  • u - username for authentication. Required.
  • extension - Device Extension.
  • fromuser - sets value for Fromuser.
  • call_timeout - max call duration (in seconds).
  • language - sets value for language.



Request

We have user_id = 2, API Secret Key = secret

We send:

HTML POST: http://<SERVER_IP>/billing/api/device_create?u=admin&user_id=2&description=desription1&pin=3&hash=6e79d4a82f68102f43be11d873177f47817f84df
  • Now we can find these Devices in GUI Devices list.

* Note that username and password are not included in hash

Returns

Success

<?xml version="1.0" encoding="UTF-8"?>
<page>
  <status>Device created</status>
  <id>id of new device</id>
  <username>username of new device</username>
  <password>password of new device</password>
</page>




Errors

  • <error>User was not found</error> - User was not found using user_id. Use correct user id.
  • <error>Incorrect hash</error> - Hash was not correct. Check API_Secret_Key and order or params while concatenating hash_string.
  • <error>Dont be so smart</error> - User with UNIQUEHASH not found or params id not send. Enter correct id.
  • <error>Device type invalid</error> - Enter correct type.
  • <error>Device group invalid</error> - Device group with id not found. Enter group id.
  • <error>Pin is already used</error> - Enter onother pin.
  • <error>Pin must be numeric</error> - Enter correct pin.
  • <error>You are not authorized to manage callerid</error> - User does not have permissions to manage CallerID option.
  • <error>Device was not created</error>
    • <message>problem message</message>

Example:

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



See also