Difference between revisions of "MOR API device create"

From Kolmisoft Wiki
Jump to navigationJump to search
Line 1: Line 1:
[[MOR API]]
=Description=
Create device
[[MOR API]] Create device
<br><br>
----
<br><br>
<br><br>
=Usage=
* Call: /api/device_create
* Call: /api/device_create
* Methods: POST, GET(if allowed, not recomended)
* Methods: POST, GET(if allowed, not recomended)
* Params:
<br><br>
** user_id - User ID in MOR database, for which user device should be created. '''Required'''.
===Parametres===
** u - username to login. '''Required'''.
** 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'''.
** 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
* 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_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>


* user_id - User ID in MOR database, for which user device should be created. '''Required'''.
* 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'''.
* 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
<br><br>
===Request===


== Request ==
We have user_id = 2, API Secret Key = secret


http://123.123.123.123/billing/api/device_create/u=admin&p=password&user_id=2&description=desription1&pin=3&hash=6e79d4a82f68102f43be11d873177f47817f84df
We send:


*admin - owner's username
HTML POST: http://<SERVER_IP>/billing/api/device_create?u=admin&user_id=2&description=desription1&pin=3&hash=6e79d4a82f68102f43be11d873177f47817f84df
*password - owner's password
 
*user_id - for which user device should be created
*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>
</page>
<br><br>
<br><br>
----
----
*Example:
**We have user_id = 2, API Secret Key = secret
**Converted Hash string like "6e79d4a82f68102f43be11d873177f47817f84df"
*We send:
**http://123.123.123.123/billing/api/device_create?u=admin&p=password&user_id=2&description=desription1&pin=3&hash=6e79d4a82f68102f43be11d873177f47817f84df
*We get:


      <head></head>
'''Errors'''
      <body>
 
            <page>
* <error>User was not found</error> - User was not found using user_id. Use correct user id.
                  <status>Device created</status>
* <error>Incorrect hash</error> - Hash was not correct. Check API_Secret_Key and order or params while concatenating hash_string.
                  <id>8</id>
* <error>Dont be so smart</error> - User with UNIQUEHASH not found or params id not send. Enter correct id.
            </page>
* <error>Device type invalid</error> - Enter correct type.
      </body>
* <error>Device group invalid</error> - Device group with id not found. Enter group id.
*We send:
* <error>Pin is already used</error> - Enter onother pin.
**http://123.123.123.123/billing/api/device_create?u=admin&p=admin1&user_id=2&type=FAX&description=desription1&pin=12366&devicegroup_id=4&hash=318fce896bf3c552ef2b3a638e0d28f7d41026a3
* <error>Pin must be numeric</error> - Enter correct pin.
*We get:
* <error>You are not authorized to manage callerid</error> - User does not have permissions to manage CallerID option.
* <error>Device was not created</error>
      <head></head>
** <message>problem message</message>
      <body>
 
            <page>
Example:
                  <status>Device created</status>
                  <id>13</id>
            </page>
      </body>


*Now we can find these Devices in GUI Devices list.
<?xml version="1.0" encoding="UTF-8"?>
<page>
  <error>Error message</error>
</page>
<br><br>
=See also=


'''* Note that username and password are not included in hash'''
* [[MOR API]]

Revision as of 09:05, 25 May 2013

Description

MOR API Create device

Usage

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



Parametres

  • user_id - User ID in MOR database, for which user device should be created. Required.
  • u - username for authentication. Required.
  • hash - SHA1 hash constructed using params and API_Secret_Key ( More described in Constructing hash). 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



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>
</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