MOR API user sms get

From Kolmisoft Wiki
Jump to navigationJump to search

Description

Retrieves list of SMS in selected time period.

Admin - can get any user SMS.

Reseller - can get his and his users SMS.

User - can get his own SMS.

Usage

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



Parameters

Parameters which are not included into hash:

  • from - Unix timestamp of calls period starting date. (Default: Today at 00:00).
  • till - Unix timestamp of calls period end date. (Default: Today at 23:59).
  • user_id - User's ID in MOR database.
  • status_code - SMS status code. Possible values are in here http://wiki.kolmisoft.com/index.php/SMS_Addon_-_Status_codes
  • provider_id - Provider ID in MOR database.
  • reseller_id - Reseller's ID in MOR database.
  • destination - Prefix.
  • number - Number of destination
  • hash - SHA1 hash constructed using parameters above and API_Secret_Key ( More described in Constructing hash). Required (if setting Disable hash checking is not checked).
  • u - username for authentication. Required.



Request

If you want find status_code=301 SMS for resellers_id = 3 and user_id = 5, through provider_id=1 in period from 2007-05-05 23:59:59 till 2016-02-17 23:59:59, with prefix = 353, and phone number=353863520065

You send:

HTML POST: http://<SERVER_IP>/billing/api/user_sms_get?u=admin&from=1178323200&till=1455667200&status_code=301&provider_id=1&user_id=5&reseller_id=3&prefix=353&number=353863520065

&hash=df2983700ffecb52e6649f0cb3981b66537083a4

* Note that username is not included in hash

Returns

<?xml version="1.0" encoding="UTF-8"?>
 <sms_messages>
   <sms_message>
     <id>1</id>
     <sending_date>2009-12-01 10:54:23 +0200</sending_date>
     <status_code>1</status_code>
     <provider_id></provider_id>
     <provider_rate>0.0</provider_rate>
     <provider_price>0.0</provider_price>
     <user_id>0</user_id>
     <user_rate>0.0</user_rate>
     <user_price>10.0</user_price>
     <reseller_id>0</reseller_id>
     <reseller_rate>0.0</reseller_rate>
     <reseller_price>0.0</reseller_price>
     <prefix></prefix>
     <number>+37061111111</number>
     <clickatell_message_id>1234</clickatell_message_id>
   </sms_message>
 </sms_messages>

NOTE that calldate is in system(server) Time Zone.

Errors:

  • <error>API Requests are disabled</error> – Allow API globally setting is unchecked.
  • <error>Access Denied</error> – Such username does not exist in the database or it was not specified.
  • <error>Incorrect hash</error> – Hash was not correct. Check API_Secret_Key and order or params while concatenating hash_string.
  • <error>Sms Mesagges were not found</error> – System did not found any SMS in this time period and with these parametres.
  • <error>You are not authorized to use this functionality</error> – User do not have permission to read SMS information.

Example:

 <status>
   <error>API Requests are disabled</error>
 </status>



See also