Difference between revisions of "MOR API devices get"

From Kolmisoft Wiki
Jump to navigationJump to search
(Created page with '<!---This functionality is available from MOR X3---> MOR API Device list <br><br> ---- * Call: /api/device_list * Params: ** u – username to login. '''Required'''. ** p …')
 
 
(12 intermediate revisions by 5 users not shown)
Line 1: Line 1:
=Description=
<!---This functionality is available from MOR X3--->
<!---This functionality is available from MOR X3--->
[[MOR API]] Device list
[[MOR API]] Device list
<br><br>
<br><br>
----
=Usage=
 
* From '''MOR X4''' call: '''/api/devices_get'''
* For Backwards-compatibility old name 'device_list' is also usable. Call: '''/api/device_list'''
* Methods: POST, GET(if allowed, not recomended)
<br><br>
===Parametres===


* Call: /api/device_list
* u – username for authentication. This is owner of User (admin or reseller) '''Required'''.
* Params:
* user_id this specifies user id whose device list to show. '''Required'''.
** u – username to login. '''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'''.
** p password to login. '''Required'''.
* show_hidden_devices – by default it is 1. When show_hidden_devices=0, then Blocked/Hidden devices will not be shown.  
** user_id – this specifies user id whose custom rates and tariffs to show. When sending user_id parameter tariff_id parameter is ignored.
** [[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 file. That file is gziped and returned as a response content.


Please note that admin can retrieve any tariff, reseller - only users' tariffs and the one assigned to him by admin and user can only retrieve to him assigned tariff.
Please note that only admin/reseller can retrieve Device list and only for their own Users.
<br><br>


===Request===


* Errors:
We have API Secret Key = 456789, user_id = 100
** <error>User not found</error> – User was not found.
 
** <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.
We send:
** <error>Incorrect hash</error> – Hash was not correct. Check API_Secret_Key and order or params while concatenating hash_string.
 
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'''
<br><br>
===Returns===
 
'''Success'''


* Returns:
  <page>
  <page>
   <devices>
   <devices>
     <device>
     <device>
         <device_id>2</device_id>
         <device_id>device_id</device_id>
         <device_type>IAX2</device_type>
         <device_type>device_type</device_type>
        <devicegroup_id>devicegroup_id</devicegroup_id>
        <primary_device>yes|no</primary_device>
        <username>device_username</username>
        <secret>device_password</secret>
        <ipaddr>device_ipaddr</ipaddr>
        <port>device_port</port>
       </device>
       </device>
    <device>
      <device>
         <device_id>3</device_id>
         <device_id>second_device_id</device_id>
         <device_type>FAX</device_type>
         <device_type>second_device_type</device_type>
      </device>
        <devicegroup_id>second_devicegroup_id</devicegroup_id>
    <device>
        <primary_device>yes|no</primary_device>
         <device_id>4</device_id>
        <username>second_device_username</username>
         <device_type>IAX2</device_type>
        <secret>second_device_password</secret>
        <ipaddr>second_device_ipaddr</ipaddr>
         <port>second_device_port</port>
         <callerid>device_callerid</callerid>
       </device>
       </device>
     </devices>
     </devices>
   </page>
   </page>
<br><br>
----
'''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.
<br><br>
<br><br>
----
 
*Example:
=See also=
**We have API Secret Key = 456789, user_id = 100
 
**Hash string to be converted: "100456789"
* [[MOR API]]
**We send:
***/api/device_list?u=admin&p=admin&user_id=100&hash=71516eea4850f7e0300ac86adf9fb64bca845aa7
'''* Note that username and password are not included in hash'''

Latest revision as of 10:31, 4 October 2023

Description

MOR API Device list

Usage

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



Parametres

  • u – username for authentication. This is owner of User (admin or reseller) Required.
  • user_id – this specifies user id whose device list to show. Required.
  • hash – SHA1 hash constructed using user_id and API_Secret_Key ( More described in Constructing hash). Required.
  • show_hidden_devices – by default it is 1. When show_hidden_devices=0, then Blocked/Hidden devices will not be shown.


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

Please note that only admin/reseller can retrieve Device list and only for their own 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>device_type</device_type>
       <devicegroup_id>devicegroup_id</devicegroup_id>
       <primary_device>yes|no</primary_device>
       <username>device_username</username>
       <secret>device_password</secret>
       <ipaddr>device_ipaddr</ipaddr>
       <port>device_port</port>
     </device>
     <device>
       <device_id>second_device_id</device_id>
       <device_type>second_device_type</device_type>
       <devicegroup_id>second_devicegroup_id</devicegroup_id>
       <primary_device>yes|no</primary_device>
       <username>second_device_username</username>
       <secret>second_device_password</secret>
       <ipaddr>second_device_ipaddr</ipaddr>
       <port>second_device_port</port>
       <callerid>device_callerid</callerid>
     </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