Difference between revisions of "MOR API sms send"

From Kolmisoft Wiki
Jump to navigationJump to search
 
(8 intermediate revisions by 5 users not shown)
Line 1: Line 1:
[[MOR API]]
= Description =
SMS API is used to integrate MOR with other external systems like CRM, ERP or other for SMS sending through them.


Send SMS
'''Note:''' SMS API can use only '''Simple Users'''.
<br><br>


= Usage =
* Call: /api/sms_send
* Methods: POST, GET(if allowed, not recomended)
<br><br>
<br><br>
----
===Parametres===
 
* lcr_id - LCR ID in MOR database. '''Required'''.
* u - username to login. '''Required'''.
* dst - Destination number. '''Required'''.
* src - Source number. '''Required'''.
* message - Message that you want to send. '''Required'''.
* [[MOR API hash construction | hash]] - SHA1 hash constructed using '''API_Secret_Key''' ([[MOR API hash construction | More described in Constructing hash]]). '''Required'''.
 
'''* Note that message must be in [http://meta.wikimedia.org/wiki/Help:URL URL Encode]'''
<br><br>
<br><br>
===Request===
We have lcr_id = 1, dst = 937567337911, src = 9375783123767, message = hi, API key = 123456
**We send:
HTML POST: http://<server_ip>/billing/api/sms_send?u=username&lcr_id=1&dst=937567337911&src=9375783123767&message=hi&hash=cc0e27123e27f08de2fbc68a2c8ba0b213654687


* Call: /api/send_sms
'''* Note that username and password are not included in hash'''
* Params:
<br><br>
** lcr_id - LCR ID in MOR database. '''Required'''.
** u - username to login. '''Required'''.
** p - password to login. '''Required'''.
** dst - Destination number. '''Required'''.
** src - Source number. '''Required'''.
** message - Message that you want to send. '''Required'''.
** [[MOR API hash construction | hash]] - SHA1 hash constructed using '''API_Secret_Key''' ([[MOR API hash construction | More described in Constructing hash]]). '''Required'''.
'''* Note that message must be in [http://meta.wikimedia.org/wiki/Help:URL URL Encode]'''


* Returns:
===Returns===
**Success
  <status>ok</status>
  <message>
    <message_id>1</message_id>
    <sms_status_code_tip>0 - sent, SMS is sent</sms_status_code_tip>
    <price>0.5000</price>
    <currency>USD</currency>
  </message>


** Errors:
'''Success'''
*** <error>There is no message or it is empty</error>
<page>
*** <error>Wrong source</error>
  <response>
*** <error>Wrong destination</error>
    <status>ok</status>
*** <error>There is no such LCR</error>
    <message>
*** <error>User is not subscribed to sms service</error>
      <message_id> message id </message_id>
*** <error>1 - failed, admin does not have rate for this destination</error> - SMS status code and tip [[SMS Addon - Status codes]]
      <sms_status_code_tip>SMS is sent</sms_status_code_tip>
*** <error>Incorrect hash</error> - Hash was not correct. Check API_Secret_Key and order or params while concatenating hash_string.
      <price> price </price>
*** <error>Bad login</error>  
      <currency> currency </currency>
    </message>
  </response>
</page>
<br><br>
<br><br>
----
----
*Example:
 
**We have lcr_id = 1, dst = 937567337911, src = 9375783123767, message = 1a2b3c4d, API key = 123456
'''Errors'''
**We send:
 
***/api/send_sms?u=username&p=password&lcr_id=1&dst=937567337911&src=9375783123767&message=1a2b3c4d&hash=cc0e27123e27f08de2fbc68a2c8ba0b213654687
* <error>There is no message or it is empty</error> – message text not found.
'''* Note that username and password are not included in hash'''
* <error>Wrong source</error> – source number is wrong.
* <error>Wrong destination</error> – destination number is wrong.
* <error>There is no such LCR</error> – LCR id not found.
* <error>User is not subscribed to sms service</error>  – user is not [[SMS_Addon#Configuration | Subscribed]] for sms usage.
* <error>System owner does not have rate for this destination</error> - SMS status code and tip [[SMS Addon - Status codes]]
* <error>Bad login</error>  – User with Username, defined in parameter '''u''', is not found.
* <error>Access Denied</error>  – User is not Simple User.
* <error>Incorrect hash</error> - Hash was not correct. Check API_Secret_Key and order or params while concatenating hash_string.
* <error>Insufficient balance</error> - The User does not have enough balance to send an SMS.
<br>
SMS status codes received from Provider are defined here [[SMS Addon - Status codes]]
<br>
 
= See also =
 
* [[MOR API]]
<br><br>

Latest revision as of 06:53, 14 June 2017

Description

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

Note: SMS API can use only Simple Users.

Usage

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



Parametres

  • lcr_id - LCR ID in MOR database. Required.
  • u - username to login. Required.
  • dst - Destination number. Required.
  • src - Source number. Required.
  • message - Message that you want to send. Required.
  • hash - SHA1 hash constructed using API_Secret_Key ( More described in Constructing hash). Required.

* Note that message must be in URL Encode

Request

We have lcr_id = 1, dst = 937567337911, src = 9375783123767, message = hi, API key = 123456

    • We send:
HTML POST: http://<server_ip>/billing/api/sms_send?u=username&lcr_id=1&dst=937567337911&src=9375783123767&message=hi&hash=cc0e27123e27f08de2fbc68a2c8ba0b213654687

* Note that username and password are not included in hash

Returns

Success

<page>
  <response>
    <status>ok</status>
    <message>
      <message_id> message id </message_id>
      <sms_status_code_tip>SMS is sent</sms_status_code_tip>
      <price> price </price>
      <currency> currency </currency>
   </message>
  </response>
</page>




Errors

  • <error>There is no message or it is empty</error> – message text not found.
  • <error>Wrong source</error> – source number is wrong.
  • <error>Wrong destination</error> – destination number is wrong.
  • <error>There is no such LCR</error> – LCR id not found.
  • <error>User is not subscribed to sms service</error> – user is not Subscribed for sms usage.
  • <error>System owner does not have rate for this destination</error> - SMS status code and tip SMS Addon - Status codes
  • <error>Bad login</error> – User with Username, defined in parameter u, is not found.
  • <error>Access Denied</error> – User is not Simple User.
  • <error>Incorrect hash</error> - Hash was not correct. Check API_Secret_Key and order or params while concatenating hash_string.
  • <error>Insufficient balance</error> - The User does not have enough balance to send an SMS.


SMS status codes received from Provider are defined here SMS Addon - Status codes

See also