Difference between revisions of "MOR API card by cli update"

From Kolmisoft Wiki
Jump to navigationJump to search
Line 4: Line 4:
[[MOR API]]
[[MOR API]]


Create and update calling cards, including adding and transferring funds, by being identified according the Caller_ID.
Availability to create and update calling cards, including adding and transferring funds, by being identified according the Caller_ID.


<br><br>
<br><br>
----
=General=
<br><br>


* Call: /api/cc_by_cli
* Call: /api/cc_by_cli
Line 37: Line 36:


Note that user has to be owner of cardgroup that id is supplied.
Note that user has to be owner of cardgroup that id is supplied.
==Example==
***/api/cc_by_cli?u=user&p=user1&callerid=123&cardgroup=3&amount=100&hash=ed9d3657ad490fa2ed860ecc93223d58bf471672
***/api/cc_by_cli?u=user&p=user1&callerid=123&cardgroup=3&hash=2b76184f5fd39ee4d149d7481c39d57fdc1f7f7a
***/api/cc_by_cli?u=user&p=user1&callerid=123&cardgroup=3&pin=321&hash=71973ad6f8d1f8a52ba17e3a2d3a4e974ac057d2
'''* Note that username and password are not included in hash'''
   
   
** Errors:
=Possible errors=
*** <error>Bad login</error> - User supplied bad login or password.
*** <error>Bad login</error> - User supplied bad login or password.
*** <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.
Line 47: Line 54:
*** <error>Device allready have such callerid, but you do not have permission to change user's balance</error> - if device with specified callerid was found but device's user A is owned by some user B, you cannot change A's balance.
*** <error>Device allready have such callerid, but you do not have permission to change user's balance</error> - if device with specified callerid was found but device's user A is owned by some user B, you cannot change A's balance.
<br><br>
<br><br>
----
 
*Example:
=API actions according to PIN being or not being supplied=
***/api/cc_by_cli?u=user&p=user1&callerid=123&cardgroup=3&amount=100&hash=ed9d3657ad490fa2ed860ecc93223d58bf471672
 
***/api/cc_by_cli?u=user&p=user1&callerid=123&cardgroup=3&hash=2b76184f5fd39ee4d149d7481c39d57fdc1f7f7a
==No PIN supplied==
***/api/cc_by_cli?u=user&p=user1&callerid=123&cardgroup=3&pin=321&hash=71973ad6f8d1f8a52ba17e3a2d3a4e974ac057d2
'''* Note that username and password are not included in hash'''

Revision as of 17:38, 31 March 2012

This functionality is available from MOR 12


MOR API

Availability to create and update calling cards, including adding and transferring funds, by being identified according the Caller_ID.



General

  • Call: /api/cc_by_cli
  • Methods: POST, GET(if allowed, not recomended)
  • Params:
    • callerid - Caller ID in MOR database, whose credit notes we want to see. Required.
    • amount - amount to transfer to calling card.
    • pin - pin of calling card, if specified amount would be ignored.
    • cardgroup_id - cardgroup ID in MOR database.
    • u - username to login. Required.
    • p - password to login. Required.
    • hash - SHA1 hash constructed using pin, amount, callerid, cardgroup_id and API_Secret_Key ( More described in Constructing hash). Required.
  • Returns:
    • Success
      • <status>
      • ok
      • </status>
      • <card>
      • <id></id>
      • <cardgroup_id></cardgroup_id>
      • <balance></balance>
      • <callerid></callerid>
      • <pin></pin>
      • <number></number>
      • </card>

Note that user has to be owner of cardgroup that id is supplied.

Example

      • /api/cc_by_cli?u=user&p=user1&callerid=123&cardgroup=3&amount=100&hash=ed9d3657ad490fa2ed860ecc93223d58bf471672
      • /api/cc_by_cli?u=user&p=user1&callerid=123&cardgroup=3&hash=2b76184f5fd39ee4d149d7481c39d57fdc1f7f7a
      • /api/cc_by_cli?u=user&p=user1&callerid=123&cardgroup=3&pin=321&hash=71973ad6f8d1f8a52ba17e3a2d3a4e974ac057d2

* Note that username and password are not included in hash


Possible errors

      • <error>Bad login</error> - User supplied bad login or password.
      • <error>Incorrect hash</error> - Hash was not correct. Check API_Secret_Key and order or params while concatenating hash_string.
      • <error>Supplied Cardgroup_id is invalid</error> - user is not the owner of cardgroup or there is no cardgroup at all.
      • <error>Failed to make transaction</error> - Something went wrong and transaction could not be completed.
      • <error>Card was not found</error> - Card with specified callerid was not found
      • <error>Callerid belongs to provider</error> - callerid belongs to provider and you cannot change that using this api method.
      • <error>Device allready have such callerid, but you do not have permission to change user's balance</error> - if device with specified callerid was found but device's user A is owned by some user B, you cannot change A's balance.



API actions according to PIN being or not being supplied

No PIN supplied