playSMS WEBSERVICES
playSMS WEBSERVICES
playSMS WEBSERVICES
antonraharja / playSMS
Branch: master playSMS / documents / development / WEBSERVICES.md Find file Copy path
2 contributors
WEBSERVICES
This document explains about playSMS webservices protocol.
Access
Example: https://playsms.org/trial/index.php?app=ws
Parameters
Listed in the below table are webservices parameters for individual tasks.
Name Description
u username
msg message (+ or %20 for spaces, urlencode for non ascii chars)
https://github.com/antonraharja/playSMS/blob/master/documents/development/WEBSERVICES.md 1/11
1/24/2018 playSMS/WEBSERVICES.md at master · antonraharja/playSMS · GitHub
Name Description
kwd keyword
Listed in the below table are webservices parameters for admin tasks.
Name Description
Return Codes
Below table listed return coded after unsuccessful call to a webservices operation. Successful operation will returns an OK
data in the response message.
Please note that by default the response message is a JSON encoded message.
ERR 402 no delivery status retrieved and SMS has been processed from queue
https://github.com/antonraharja/playSMS/blob/master/documents/development/WEBSERVICES.md 2/11
1/24/2018 playSMS/WEBSERVICES.md at master · antonraharja/playSMS · GitHub
There might appear new error codes in the future, you should be aware that new codes might appear in this syntax:
https://github.com/antonraharja/playSMS/blob/master/documents/development/WEBSERVICES.md 3/11
1/24/2018 playSMS/WEBSERVICES.md at master · antonraharja/playSMS · GitHub
Send message
Send message to a single or multiple mobile numbers, @username or #groupcode
Operation pv
Mandatory u h to msg
Parameter to can be international formatted mobile number, #groupcode or @username, or a mix of them. Separate by
commas for multiple value.
Operation ds
Mandatory u h
Parameter c will retrieve as many as c value, last will retrieves data from last SMS log ID.
Incoming SMS
List incoming SMS.
Operation in
Mandatory u h
Parameter c will retrieve as many as c value, last will retrieves data from last SMS log ID.
Inbox
List SMS on user's inbox.
Operation ix
Mandatory u h
Parameter c will retrieve as many as c value, last will retrieves data from last SMS log ID.
https://github.com/antonraharja/playSMS/blob/master/documents/development/WEBSERVICES.md 4/11
1/24/2018 playSMS/WEBSERVICES.md at master · antonraharja/playSMS · GitHub
Sandbox
List unhandled incoming SMS.
Operation sx
Mandatory u h
Parameter c will retrieve as many as c value, last will retrieves data from last SMS log ID.
User credit
Get user's credit information.
Operation cr
Mandatory u h
Optional format
Get token
Get user's webservices token. This can be used as a login mechanism.
Operation get_token
Mandatory u p
Optional format
Set token
Set user's webservices token. This can be used as a change password mechanism.
Operation set_token
Mandatory u h
Optional format
https://github.com/antonraharja/playSMS/blob/master/documents/development/WEBSERVICES.md 5/11
1/24/2018 playSMS/WEBSERVICES.md at master · antonraharja/playSMS · GitHub
Operation get_contact
Mandatory u h kwd
Optional c format
Operation get_contact_group
Mandatory u h kwd
Optional c format
Returns list of contact groups similar or the same as kwd or return codes
Webservices login
Authenticate user via webservices and redirect to index.php upon authentication, successful or failed or invalid
Operation ws_login
Mandatory u login_key
Optional none
Parameter login_key is set by admin accounts through webservices call using operation loginkeyset
Query
Query server for useful information such as user's data, user's credit, last smslog_id for inbox, incoming and outgoing SMS
Operation query
Mandatory u h
Optional format
Inject message
Inject message to the system
Operation inject
https://github.com/antonraharja/playSMS/blob/master/documents/development/WEBSERVICES.md 6/11
1/24/2018 playSMS/WEBSERVICES.md at master · antonraharja/playSMS · GitHub
Optional format
Stoplist Number
Will add a number to the stoplist.
Operation stoplist
Mandatory u h from
Optional none
Number used in the 'from' field will be added to the stoplist feature to globally prevent outgoing messages sending to it.
example: http://yoursite.com/playsms/index.php?app=ws&u=<admin user>&h=<webkey>&op=stoplist&from=<number to
be added>
Add account
Add an account
Operation accountadd
Notes:
most mandatory and optional query parameters are prefixed with data_
data_status 2 is for admin level account
data_status 3 is for user level account
data_status 4 is for subuser level account
data_parent may need to be set when adding subuser level account
Remove account
Remove an account
Operation accountremove
Mandatory u h data_username
Optional format
https://github.com/antonraharja/playSMS/blob/master/documents/development/WEBSERVICES.md 7/11
1/24/2018 playSMS/WEBSERVICES.md at master · antonraharja/playSMS · GitHub
Operation parentset
Optional format
Operation parentget
Mandatory u h data_username
Optional format
Ban an account
Ban an account
Operation accountban
Mandatory u h data_username
Optional format
Unban an account
Unban an account
Operation accountunban
Mandatory u h data_username
Optional format
Operation accountpref
https://github.com/antonraharja/playSMS/blob/master/documents/development/WEBSERVICES.md 8/11
1/24/2018 playSMS/WEBSERVICES.md at master · antonraharja/playSMS · GitHub
Mandatory u h data_username
Notes:
most mandatory and optional query parameters are prefixed with data_
this command may be used to update account's password
Operation accountconf
Mandatory u h data_username
Notes:
most mandatory and optional query parameters are prefixed with data_
this command may be used to update account's default sender ID
only valid sender ID may be selected
data_fwd_to_inbox data_fwd_to_email data_fwd_to_mobile are boolean variables, fill with 0 to disable and 1 to
enable
data_local_length used to detect local destination number by its length
Operation creditview
Mandatory u h data_username
Optional format
Operation creditadd
https://github.com/antonraharja/playSMS/blob/master/documents/development/WEBSERVICES.md 9/11
1/24/2018 playSMS/WEBSERVICES.md at master · antonraharja/playSMS · GitHub
Optional format
Operation creditdeduct
Optional format
Operation loginkeyset
Mandatory u h data_username
Optional format
Examples
Send SMS
Example webservice URL:
http://x.dom/index.php?
app=ws&u=anton&h=a45a02791b2fe2fedb078c39fd83637a&op=pv&to=0987654321&msg=test+only
Explanation:
playSMS webservices in x.dom with operation op pv (send SMS) was accessed by a user using username u and
webservices token h with destination number to 0987654321, message msg 'test only' and expected output format is the
default format, JSON format.
{"data":
[{"status":"OK","error":"0","smslog_id":"30","queue":"afb5f34575e30ec4efe4471cf5d1bee4","to":"0987654321"}]
When error occurred playSMS will returns one of the return code, also in JSON format.
http://x.com/index.php?app=ws&u=anton&h=482ac0069592c647289e52dfef88be68&op=in&kwd=IDOL&format=xml
Explanation:
playSMS webservices in x.com with operation op in (incoming SMS) was accessed by a user using username u and
webservices token h with keyword kwd IDOL and expected output format is in XML format format=xml .
<response>
<data>
<item>
<id>2</id>
<src>+629876543210</src>
<dst>1234</dst>
<kwd>IDOL</kwd>
<msg>A</msg>
<dt>2013-05-20 12:40:38</dt>
<status>1</status>
</item>
</data>
</response>
When error occurred playSMS will returns one of the return code, also in XML format.
http://x.com/index.php?app=ws&u=anton&h=482ac0069592c647289e52dfef88be68&op=get_contact&kwd=anton
Explanation:
playSMS webservices in x.com with operation op get_contact was accessed by a user using username u and webservices
token h with keyword kwd anton and expected output format is in JSON format.
{"status":"OK","error":"0","data":[{"pid":"13674","gpid":"2","p_desc":"Anton
Raharja","p_num":"08901230659","email":"","group_name":"Test Group","code":"TESTGROUP"}],"multi":true}
When error occurred playSMS will returns one of the return code, also in JSON format.
https://github.com/antonraharja/playSMS/blob/master/documents/development/WEBSERVICES.md 11/11