Difference between revisions of "M4 API devices get"

From Kolmisoft Wiki
Jump to navigationJump to search
m (Admin moved page M2 API devices get to M4 API devices get)
 
Line 5: Line 5:
=Usage=
=Usage=


* From '''M2''' call: '''/api/devices_get'''
* From '''M4''' call: '''/api/devices_get'''
* For Backwards-compatibility old name 'device_list' is also usable. Call: '''/api/device_list'''
* For Backwards-compatibility old name 'device_list' is also usable. Call: '''/api/device_list'''
* Methods: POST, GET(if allowed, not recomended)
* Methods: POST, GET(if allowed, not recommended)
* Scope: Only the System Admin and Managers (with a '''USERS > Connection Points permission''') can use the method
* Scope: Only the System Admin and Managers (with a '''USERS > Connection Points permission''') can use the method
<br><br>
<br><br>
Line 13: Line 13:


* u – username for authentication. '''Required'''.
* u – username for authentication. '''Required'''.
* user_id – this specifies user id whose device list to show.  
* user_id – this specifies the user id whose device list to show.  
* [[MOR API hash construction | hash]] – SHA1 hash constructed using '''user_id''' and '''API_Secret_Key''' ([[MOR API hash construction | More described in Constructing hash]]). '''Required'''.
* [[MOR API hash construction | hash]] – SHA1 hash constructed using '''user_id''' and '''API_Secret_Key''' ([[MOR API hash construction | More described in Constructing hash]]). '''Required'''.


Returning XML is put in file. That file is gziped and returned as a response content.
Returning XML is put in a file. That file is gzipped and returned as response content.


Please note that the Admin/Manager can retrieve Device list just for the Admin's Users.
Please note that the Admin/Manager can retrieve the Device list just for the Admin's Users.
<br><br>
<br><br>
===Request===
===Request===
Line 60: Line 60:
* <error>Incorrect hash</error> – Hash was not correct. Check API_Secret_Key and order or params while concatenating hash_string.
* <error>Incorrect hash</error> – Hash was not correct. Check API_Secret_Key and order or params while concatenating hash_string.
<br><br>
<br><br>
=See also=
=See also=


* [[M2 API]]
* [[M4 API]]

Latest revision as of 11:29, 28 November 2022

Description

MOR API Device list

Usage

  • From M4 call: /api/devices_get
  • For Backwards-compatibility old name 'device_list' is also usable. Call: /api/device_list
  • Methods: POST, GET(if allowed, not recommended)
  • Scope: Only the System Admin and Managers (with a USERS > Connection Points permission) can use the method



Parameters

  • u – username for authentication. Required.
  • user_id – this specifies the user id whose device list to show.
  • hash – SHA1 hash constructed using user_id and API_Secret_Key ( More described in Constructing hash). Required.

Returning XML is put in a file. That file is gzipped and returned as response content.

Please note that the Admin/Manager can retrieve the Device list just for the Admin's Users.

Request

We have API Secret Key = 456789, user_id = 100

We send:

HTML POST: http://<SERVER_IP>/billing/api/devices_get?u=admin&user_id=100&hash=71516eea4850f7e0300ac86adf9fb64bca845aa7

* Note that username and password are not included in hash

Returns

Success

<page>
  <devices>
    <device>
       <device_id>device_id</device_id>
       <device_type>SIP</device_type>
       <ipaddr>device_ipaddr</ipaddr>
       <port>device_port</port>
     </device>
     <device>
       <device_id>second_device_id</device_id>
       <device_type>SIP</device_type>
       <ipaddr>second_device_ipaddr</ipaddr>
       <port>second_device_port</port>
     </device>
   </devices>
 </page>




Errors

  • <error>User not found</error> – User was not found.
  • <error>user_id is empty</error> – user_id was not sent.
  • <error>Bad login</error> – User was not found by username and password. Use correct username and password. Make sure that username (u) and password (p) are specified.
  • <error>Incorrect hash</error> – Hash was not correct. Check API_Secret_Key and order or params while concatenating hash_string.



See also