Difference between revisions of "MOR API did create"

From Kolmisoft Wiki
Jump to navigationJump to search
(Created page with 'MOR API Create DID <br><br> ---- <br><br> * Call: /api/did_create * Methods: POST, GET(if allowed, not recomended) * Params: ** did - DID number to be created '''Required'''.…')
 
 
(20 intermediate revisions by 7 users not shown)
Line 1: Line 1:
[[MOR API]]
=Description=
Create DID
<!-- This functionality is available from MOR X3 -->
<br><br>
[[MOR API]] Create DID
----
<br><br>
<br><br>
=Usage=
* Call: /api/did_create
* Call: /api/did_create
* Methods: POST, GET(if allowed, not recomended)
* Methods: POST, GET(if allowed, not recomended)
* Params:
** did - DID number to be created '''Required'''.
** provider_id - Provider ID in MOR database, for which DID should be created '''Required'''.
** u - username to login. '''Required'''.
** p - password to login. '''Required'''.
** [[MOR API hash construction | hash]] - SHA1 hash constructed using '''params''' and '''API_Secret_Key''' ([[MOR API hash construction | More described in Constructing hash]]). '''Required'''.
* Returns:
**Success
*** <status>DID created</status>
** Errors:
*** <error>Incorrect hash</error> - Hash was not correct. Check API_Secret_Key and order or params while concatenating hash_string.
*** <error>Don't be so smart</error> - User with UNIQUEHASH not found or params id not send. Enter correct id.
*** <error>Provider was not found</error> - Enter existing Provider ID.
*** <error>Your are not authorized to use this Provider</error> - Specified Provider is not available to this user.
*** <error>You are not authorized to manage DIDs</error> - If Accountant or Reseller is using API, they should have all permissions to perform specified actions.
*** <error>DID already exists</error> - Enter unique DID number.
*** <error>Invalid DID specified</error> - Enter a valid (numeric) DID number.
*** <error>DID creation failed</error>
<br><br>
<br><br>
== Request ==
===Parametres (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'''.
 
Note that when creating DID from '''Reseller'''`s account, provider_id parameter is '''not required''', but also can be used. In this case default provider id will be used.
* [[MOR API hash construction | hash]] - SHA1 hash constructed using '''params''' and '''API_Secret_Key''' ([[MOR API hash construction | More described in Constructing hash]]). '''Required'''.
'''provider_id and did are included in hash. username is not included in hash.'''
<br><br>
 
===Request===
 
We have provider_id = 1, API Secret Key = secret. We want to create DID with number 123456789.
 
We send:
 
HTML POST: http://<SERVER_IP>/billing/api/did_create?u=username&did=123456789&provider_id=1&hash=bc2f114099d16656d37e45fd9e8744cb9386d462
 
 
Now we can find these DIDs in GUI DID list.
 
<br><br>


http://123.123.123.123/billing/api/device_create/u=admin&p=password&did=123456789&provider_id=1&hash=bc2f114099d16656d37e45fd9e8744cb9386d462
===Returns===


*admin - owner's username
'''Success'''
*password - owner's password
<?xml version="1.0" encoding="UTF-8"?>
*did - DID number
<page>
*provider_id - Provider ID for which DID should be created
  <status>
      <success>DID created</success>
  </status>
  <did_details>
      <id>3</id>
  </did_details>
</page>
<br><br>
<br><br>
----
----
*Example:
**We have provider_id = 1, API Secret Key = secret
**Converted Hash string like "bc2f114099d16656d37e45fd9e8744cb9386d462"
*We send:
**http://123.123.123.123/billing/api/device_create/u=admin&p=password&did=123456789&provider_id=1&hash=bc2f114099d16656d37e45fd9e8744cb9386d462
*We get:


            <page>
'''Errors'''
                  <status>DID created</status>
 
                  <id>5</id>
<?xml version="1.0" encoding="UTF-8"?>
            </page>
<page>
  <status>
      <error>Error message</error>
  </status>
</page>


*We send:
Error messages:
**http://123.123.123.123/billing/api/device_create/u=admin&p=password&did=123456790&provider_id=1&hash=bc2f114099d16656d37e45fd9e8744cb9386d462
*We get:


            <page>
* Incorrect hash – Hash was not correct. Check API_Secret_Key and order or params while concatenating hash_string.
                  <status>DID created</status>
* Access Denied – Only Admin, Accountant or Reseller may use API.
                  <id>6</id>
* Provider was not found – Enter existing Provider ID.
            </page>
* Your are not authorized to use this Provider – Specified Provider is not available to this user.
* You are not authorized to manage DIDs – If Accountant or Reseller is using API, they should have all permissions to perform specified actions.
* DID already exists – Enter unique DID number.
* Invalid DID specified – Enter a valid (numeric) DID number.
* DID creation failed – unknown error
<br><br>


*Now we can find these DIDs in GUI DID list.
=See also=


'''* Note that username and password are not included in hash'''
* [[MOR API]]

Latest revision as of 06:57, 10 December 2020

Description

MOR API Create DID

Usage

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



Parametres (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.

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

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

Request

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

We send:

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


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



See also