MOR API did create

From Kolmisoft Wiki
Jump to navigationJump to search

Description

MOR API Create DID

Usage

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



Parameters (in this order only)

  • u - username for authentication. Required.
  • provider_id - Provider ID in MOR database, for which DID should be created Required.
  • did - DID number to be created Required.
  • custom_sip_header - adds a custom SIP header.

Note that when creating a DID from Reseller`s account, the provider_id parameter is not required, but also can be used. In this case, the default provider ID will be used.

provider_id and did are included in the hash. username is not included in the hash.


Parameters which are not included in hash

  • custom_sip_header - adds a custom SIP header.
  • comment - main DID comment (same field as the GUI Comment box for admin/accountant). Optional. An empty value (comment=) clears the comment.
  • reseller_comment - reseller-specific DID comment. Optional. An empty value (reseller_comment=) clears the comment.



Request

We have provider_id = 1, API Secret Key = secret. We want to create a DID with the number 123456789.

We send:

HTML POST: http://<SERVER_IP>/billing/api/did_create?u=username&did=123456789&provider_id=1&hash=bc2f114099d16656d37e45fd9e8744cb9386d462


We can now find these DIDs in the GUI DID list.



Returns

Success

<?xml version="1.0" encoding="UTF-8"?>
<page>
  <status>
     <success>DID created</success>
  </status>
  <did_details>
     <id>3</id>
  </did_details>
</page>




Errors

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

Error messages:

  • Incorrect hash – The 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 the API.
  • Provider was not found – Enter existing Provider ID.
  • You are not authorized to use this Provider – Specified Provider is not available to this user.
  • You are not authorized to manage DIDs – If the Accountant or Reseller is using the API, they should have all permissions to perform specified actions.
  • DID already exists – Enter a unique DID number.
  • Invalid DID specified – Enter a valid (numeric) DID number.
  • DID creation failed – unknown error



See also