Difference between revisions of "MOR API did details update"

From Kolmisoft Wiki
Jump to navigationJump to search
 
(6 intermediate revisions by 3 users not shown)
Line 4: Line 4:


Please note that only admin, accountant(with device management) with permission and reseller can use this API.  
Please note that only admin, accountant(with device management) with permission and reseller can use this API.  
<br><br>
<br><br>
=Usage=
=Usage=
Line 10: Line 9:
* Call: /api/did_details_update
* Call: /api/did_details_update
* Methods: POST, GET(if allowed, not recomended)
* Methods: POST, GET(if allowed, not recomended)
<br><br>
<br><br>
===Parametres===
===Parametres===
Line 16: Line 14:
Parameter which is '''included''' into hash:
Parameter which is '''included''' into hash:


* '''did_id''' – this is id of DID which have to be updates. '''Required'''.
* '''did_id''' – this is id of DID which have to be updated. '''Required'''.


'''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'''
'''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'''
Line 25: Line 23:
* '''u''' – username to login. '''Required'''.
* '''u''' – username to login. '''Required'''.
* '''call_limit''' – call limit of did which will be updated. '''Optional'''
* '''call_limit''' – call limit of did which will be updated. '''Optional'''
* <!--FROM MOR X6--->'''did_user_id''' –  User ID from database whom DID should be assigned. Just free DID can be assigned to User. DID can be assigned to Reseller or simple User. Set -1 to make DID free. '''Optional'''
* <!--FROM MOR X6--->'''did_user_id''' –  User ID from database whom DID should be assigned. '''Just free DID can be assigned to User.''' DID can be assigned to Reseller or simple User. Set -1 to make DID free. '''Optional'''
 
* '''active_from''' - Active from date in Unix timestamp format. '''Optional'''.
* '''active_till''' - Active till date in Unix timestamp format. '''Optional'''.
* '''grace_time''' - same as [[DID_Management#Details|Grace Time GUI option]]: If call duration is less than Grace Time, it will not be accounted, for example: Grace Time = 3s, call duration <= 3s, then price for the call = 0. '''Optional'''
* '''language''' - allows setting two letters (i.e. en, it, es, ...) language code. '''Optional'''
<br><br>
<br><br>


===Request===
===Request===


We have API Secret Key = secret, did_id = 6511 <br />
We have API Secret Key = secret, did_id = 6511 <br>
We send:
We send:


  HTML POST: http://<server_ip>/billing//api/did_details_update?u=admin&did_id=6511&call_limit=999&hash=f7de355c9b4421ce6c705b4b32c89dbcaca51e46
  HTML POST: http://<server_ip>/billing/api/did_details_update?u=admin&did_id=6511&call_limit=999&hash=f7de355c9b4421ce6c705b4b32c89dbcaca51e46


'''* Note that username and password are not included in hash'''
'''* Note that username is not included in hash'''
<br><br>
<br><br>


Line 53: Line 54:
----
----
'''Errors'''
'''Errors'''
* <error>Call limit is incorrect format</error> – Specified call limit is 0 or positive number.
* <error>DID was not found</error> – Specified did does not exist or it belongs to different username(u).
* <error>Access Denied</error> – Specified username (u) does not exist or u is not admin, reseller or accountant with permission.
* <error>Access Denied</error> – Specified username (u) does not exist or u is not admin, reseller or accountant with permission.
* <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.
* <error>Call limit is incorrect format</error> – Specified call limit has to be 0 or positive number.
* <error>DID is already assigned</error> – DID is already assign to other User, Reseller or Dial Plan.
* <error>DID was not found</error> – Specified did does not exist or it belongs to different username(u).
* <error>Active till must be greater than Active from</error>
* <error>Active till must be a valid timestamp</error>
* <error>Active from must be a valid timestamp</error>
<br><br>
<br><br>



Latest revision as of 10:47, 20 June 2023

Description

MOR API DID details update

Please note that only admin, accountant(with device management) with permission and reseller can use this API.

Usage

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



Parametres

Parameter which is included into hash:

  • did_id – this is id of DID which have to be updated. Required.

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 did_id and API_Secret_Key ( More described in Constructing hash). Required.
  • u – username to login. Required.
  • call_limit – call limit of did which will be updated. Optional
  • did_user_id – User ID from database whom DID should be assigned. Just free DID can be assigned to User. DID can be assigned to Reseller or simple User. Set -1 to make DID free. Optional
  • active_from - Active from date in Unix timestamp format. Optional.
  • active_till - Active till date in Unix timestamp format. Optional.
  • grace_time - same as Grace Time GUI option: If call duration is less than Grace Time, it will not be accounted, for example: Grace Time = 3s, call duration <= 3s, then price for the call = 0. Optional
  • language - allows setting two letters (i.e. en, it, es, ...) language code. Optional



Request

We have API Secret Key = secret, did_id = 6511
We send:

HTML POST: http://<server_ip>/billing/api/did_details_update?u=admin&did_id=6511&call_limit=999&hash=f7de355c9b4421ce6c705b4b32c89dbcaca51e46

* Note that username is not included in hash

Returns

Success

<page>
 <status>
   <success>DID details successfully updated</success>
 </status>
</page>

After successfully updating DID action log record is added.


Errors

  • <error>Access Denied</error> – Specified username (u) does not exist or u is not admin, reseller or accountant with permission.
  • <error>Incorrect hash</error> – Hash was not correct. Check API_Secret_Key and order or params while concatenating hash_string.
  • <error>Call limit is incorrect format</error> – Specified call limit has to be 0 or positive number.
  • <error>DID is already assigned</error> – DID is already assign to other User, Reseller or Dial Plan.
  • <error>DID was not found</error> – Specified did does not exist or it belongs to different username(u).
  • <error>Active till must be greater than Active from</error>
  • <error>Active till must be a valid timestamp</error>
  • <error>Active from must be a valid timestamp</error>



See also