MOR API did rates update

From Kolmisoft Wiki
Revision as of 17:12, 24 July 2018 by Gilbertas (talk | contribs)
Jump to navigationJump to search

Description

MOR API Update DID rates

Usage

  • From MOR X12 call: /api/did_rates_update
  • Methods: POST, GET(if allowed, not recommended)



Parameters

Parameters which are included into hash:

  • did - DID number Required.

Parameters which are not included into hash:

  • u - username for authentication. Required.
  • s_id - did rate id.
  • s_rate_type - type of rate, allowed values are: provider, owner, incoming.

either s_id or s_rate_type must be provided, s_id can be found using MOR API did rates get.

  • rate - new rate value.
  • connection_fee - new connection fee value.
  • increment_s - new increment value.
  • min_time - new min time value.
  • s_start_time - start time of rate, format is hh:mm:ss.
  • s_end_time - end time of rate, format is hh:mm:ss.
  • s_daytype - day type of rate, allowed values are WD and FD.
  • hash - SHA1 hash constructed using params and API_Secret_Key ( More described in Constructing hash). Required.



Request

We have DID 370123456789, API Secret Key = secret

We send

HTML POST: http://<SERVER_IP>/billing/api/did_rates_update?did=370123456789&u=admin&s_rate_type=provider&rate=0.5&hash=a2ceb0323d6a76a9fc9b66a21d321ae618c40296



Returns

<?xml version="1.0" encoding="UTF-8"?>
<page>
  <updated_rates>1 </updated_rates>
  <rates>
    <rate>
      <id>49</id>
      <start_time>00:00:00</start_time>
      <end_time>23:59:59</end_time>
      <rate>0.5</rate>
      <connection_fee>0.0</connection_fee>
      <increment_s>1</increment_s>
      <min_time>0</min_time>
      <did_id>17</did_id>
      <rate_type>provide</rate_type>
      <daytype></daytype>
    </rate>
  </rates>
</page>

Errors

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

Error messages:

  • Incorrect hash – Hash was not correct. Check API_Secret_Key and order or params while concatenating hash_string.
  • Access Denied – Only Admin, Accountant or Reseller may use API.
  • DID was not found – DID number does not exist or incorrect.
  • Rates were not found - rates were not found using one of search parameters: s_id, s_rate_type, s_start_time, s_end_time, s_daytype.



See also