This API is the way you connect your server with ours. It is a very simple integration, essentially it calls our web service, which will send the message and will keep reporting in your account.
Implementing the API:
Login with you user name and password of your advertiser account > click edit profile > next to API ID click “Generate”
Embed the following parameters:
user = the user name of your advertiser account
api_id = the code you have generated under edit profile
mobile = the mobile phone number to send to
message – the message to send to the recipient
format (optional) - set as xml if you want to supply the parameters by XML file, if present then parameters from xml will be used.
json (optional) – true/false set as true if you want a response with json format
Use this example to test the API:
Replace USER_NAME with advertiser user name
Replace API_ID with the code generated
Replace MOBILE_NUMBER with the phone number must include the 1 prefix
Replace TEXT with the message to be send
https://mcpn.us/sendsmsapi?user=USER_NAME&api_id=API_ID&mobile=MOBILE_NUMBER&message=TEXT
These parameters must be supply and they are case sensitive.
For xml use:
https://mcpn.us/sendsmsapi?format=xml
XML File:
<?xml version="1.0" ?>
<Data>
<User>user</User>
<ApiId>api key</ApiId>
<Message>message</Message>
<Mobile>mobile</Mobile>
</Data>
Return Code
If the API succeeds then it will return with status code 200.
If an error occurs or there is an invalid parameter then it returns with status code 400, 403 or 500.
Response
Normal
If the json option is not set or set to false the response will be in the body with the error message.
JSON
If the json option is set to true then the response will be with a json object with the status and error Id and error message as the following (see full error ID list below):
In case of success:
{
"Status":"OK"
}
In case of error:
{
"Status":"Error",
"ErrorId":"105",
"ErrorMessgae":"parameter: message is empty"
}
In case of error for some mobile numbers (Error ID 120):
{
"Status":"Error",
"ErrorId":"120",
"mobiles":[{
"Status":"Error",
"ErrorId":"112",
"mobile":"15555555555",
"ErrorMessgae": "parameter: mobile: 972522 is invalid"}],
"ErrorMessgae":"Some mobiles got errors check mobiles array for details"
}
Error ID List
101 - Error while parse xml
102- parameter: user is empty
103 - parameter: api_id is empty
104 - parameter: mobile is empty
105 - parameter: message is empty
106 - Error while getting user data
107 - user not exists or invalid api id
108 - This API is not enabled please contact support
109 - Error at message: invalid character
110 - Error at message: This text contains illegal prohibited content
111 – Credits error
112 - parameter: mobile: <MOBILE> is invalid
113 - This mobile number: <MOBILE> is not opted in to any of your opt-in lists
114 – Error while creating mobile user
115 - Error number: <MOBILE> is invalid
116 - Error number: <MOBILE> is opted out
117 - Error number: <MOBILE> is got an error while sending SMS
120 - Some mobiles got errors check mobiles array for details
130 - General Error
0 Comments