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 text</Message>
<Mobile>mobile</Mobile>
</Data>
For JSON use:
https://mcpn.us/sendsmsapi?format=json
JSON:
{
“user”: “username”,
“apiId”: ”api key”,
“message”: “message text”,
“mobiles”: [“15555555555”]
}
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
Error ID | Error Message | Action |
101 | Error while parse xml | No retry |
102 | parameter: user is empty | No retry |
103 | parameter: api_id is empty | No retry |
104 | parameter: mobile is empty | No retry |
105 | parameter: message is empty | No retry |
106 | Error while getting user data | Retry |
107 | user not exists or invalid api id | No retry |
108 | This API is not enabled please contact support | No retry |
109 | Error at message: invalid character | No retry |
110 | Error at message: This text contains illegal prohibited content | No retry |
111 | Credits error | No retry |
112 | parameter: mobile: <MOBILE> is invalid | No retry |
113 | This mobile number: <MOBILE> is not opted in to any of your opt-in lists | No retry |
114 | Error while creating mobile user | Retry |
115 | Error number: <MOBILE> is invalid | No retry |
116 | Error number: <MOBILE> is opted out | No retry |
117 | Error number: <MOBILE> is got an error while sending SMS | No retry |
120 | Some mobiles got errors check mobiles array for details | No retry |
130 | General Error | Retry |
Comments
0 comments
Article is closed for comments.