MOR API user sms service subscribe

From Kolmisoft Wiki
Revision as of 14:25, 6 February 2015 by Ervinas (talk | contribs) (→‎Returns)
Jump to navigationJump to search

Description

SMS API is used to integrate MOR with other external systems like CRM, ERP or other for User subscribing for SMS sending through them.

User for SMS service via API can be subscribed by admin and reseller.

Usage

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



Parametres

Parameters which are included into hash:

  • user_id - Users ID in MOR database, whose balance we want to change. Required.
  • sms_tariff_id - ID of SMS Tariff for User. 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:

  • u - username to login. Required. (The User who makes subscription: admin/reseller, not the user himself!)
  • sms_lcr_id - admin LCR ID. For Admin this parameter is required, when Reseller subscribes his Users for SMS service, LCR which is assigned to that Reseller will be used.
  • hash - SHA1 hash constructed using parameters above and API_Secret_Key ( More described in Constructing hash). Required.



Request

We have user_id, sms_lcr_id = 1, sms_tariff_id, API key = 123456

    • We send:
HTML POST: http://<server_ip>/billing/api/user_sms_service_subscribe?u=admin&user_id=2&sms_tariff_id=1&sms_lcr_id=1&hash=f600528fc40daff85d0c0a7b413256f1e3d5f408

* Note that username and password are not included in hash

Returns

Success

<?xml version="1.0" encoding="UTF-8"?>
<page>
  <status>
    <success>User successfully subscribed to SMS service</success>
  </status>
</page>




Errors

  • <error>SMS Tariff was not found</error> – Tariff id not found.
  • <error>SMS Tariff was not selected</error>
  • <error>SMS LCR was not found</error> – LCR id not found.
  • <error>SMS LCR was not selected</error>
  • <error>User was not found</error> – User id not found.
  • <error>User was not selected</error>
  • <error>User is already subscribed to SMS service </error>
  • <error>Access Denied</error> – User with Username, defined in parameter u, is not found.
  • <error>Incorrect hash</error> – Hash was not correct. Check API_Secret_Key and order or params while concatenating hash_string.
  • <error>API must have Secret Key</error>
  • <error>You are not authorized to use this functionality</error>
  • <error>Reseller does not have SMS Subscription</error>



See also