Overview of Server REST API
JSMS provides REST-compliant HTTP APIs for developers to remotely invoke services provided by JSMS.
At the same time, in order to facilitate developers to use JSMS API easier, a variety of commonly used programming languages (SDKs) are also provided.
Basic Constraints of REST API
- The API is designed to conform to the HTTP, REST specification. For example: Use the Get method when querying requests, and Use the Post method when submitting requests. If a request is not a corresponding HTTP method, an error will be returned.
- Unless otherwise specified, the value of called parameter should be transcoded to: UTF-8, URL encoded [^1].
[1]: URL Encoding - WikiPedia Definition
API Resource List
SMS Sending API
Name | Resource |
---|---|
Sending SMS with Text Verification Code API | POST https://api.sms.jpush.cn/v1/codes |
Sending SMS with Voice Verification Code API | POST https://api.sms.jpush.cn/v1/voice_codes |
Verification Code Verifying API | POST https://api.sms.jpush.cn/v1/codes/{msg_id}/valid |
Sending Single Template SMS API | POST https://api.sms.jpush.cn/v1/messages |
Sending Bulk Template SMS API | POST https://api.sms.jpush.cn/v1/messages/batch |
Scheduled SMS API
Name | Resource |
---|---|
Single Scheduled SMS Submitting API | POST https://api.sms.jpush.cn/v1/schedule |
Scheduled SMS Bulk Submitting API | POST https://api.sms.jpush.cn/v1/schedule/batch |
Single Scheduled SMS Modifying API | PUT https://api.sms.jpush.cn/v1/schedule/{schedule_id} |
Scheduled SMS Bulk Modifying API | PUT https://api.sms.jpush.cn/v1/schedule/batch/{schedule_id} |
Scheduled SMS Querying API | GET https://api.sms.jpush.cn/v1/schedule/{schedule_id} |
Scheduled SMS Deleting API | DELETE https://api.sms.jpush.cn/v1/schedule/{schedule_id} |
SMS Margin Querying API
Name | Resource |
---|---|
Account Margin Querying API | GET https://api.sms.jpush.cn/v1/accounts/dev |
Application Margin Querying API | GET https://api.sms.jpush.cn/v1/accounts/app |
Return Code
If the request fails, the API will return the following return code and description in JSON format
{
"error": {
"code": *****,
"message": "*****"
}
}
Summary of REST API Return Code
HTTP CODE | CODE | MESSAGE | DESC |
---|---|---|---|
HTTP CODE | CODE | MESSAGE | DESC |
200 | 50000 | success | Request succeeded |
400 | 50001 | missing auth | auth is empty |
401 | 50002 | auth failed | Authentication of Auth failed |
400 | 50003 | missing body | body is empty |
400 | 50004 | missing mobile | Phone number is empty |
400 | 50005 | missing temp_id | Template ID is empty |
403 | 50006 | invalid mobile | Phone number is invalid |
403 | 50007 | invalid body | body is invalid |
403 | 50008 | no sms code auth | Not open SMS service |
403 | 50009 | out of freq | Send overclocking |
403 | 50010 | invalid code | Verification code is invalid |
403 | 50011 | expired code | Verification code expired |
403 | 50012 | verified code | Verification code has been verified |
403 | 50013 | invalid temp_id | Template ID is invalid |
403 | 50014 | no money | SMS to deliver is insufficient |
400 | 50015 | missing code | Verification code is empty |
404 | 50016 | api not found | API does not exist |
415 | 50017 | media not supported | Media type is not supported |
405 | 50018 | request method not support | Request method is not supported |
500 | 50019 | server error | Server exception |
403 | 50020 | template auditing | The template is in auditing |
403 | 50021 | template not pass | Template failed the auditing. |
403 | 50022 | parameters not all replaced | Not all parameters in the template are replaced |
403 | 50023 | parameters is empty | The parameter is empty |
403 | 50024 | unsubscribed mobile | Phone number has been unsubscribed |
403 | 50025 | wrong template type | API does not support this template type |
403 | 50026 | wrong msg_id | msg_id is invalid |
403 | 50027 | invalid send_time | send_time is empty or before the current time |
403 | 50028 | invalid schedule_id | schedule_id is invalid |
403 | 50029 | wrong schedule status | Scheduled SMS has been sent or deleted and cannot be modified |
403 | 50030 | recipients is empty | Recipients are empty |
403 | 50031 | too much recipients | Recipients of SMS exceeds 1000 |
403 | 50034 | repeat send | Send repeatedly |
403 | 50035 | illegal IP | Illegal IP request |
403 | 50036 | app in black | The application is listed as blacklist |
403 | 50037 | has black word | SMS content contains sensitive vocabulary |
403 | 50038 | invalid code length | Length of the voice verification code is wrong |
403 | 50039 | invalid code type | The voice verification code is wrong. The verification code only supports digital |
403 | 50040 | invalid voice language type | Broadcast language type of voice verification code is wrong |
403 | 50041 | invalid ttl value | Validity of verification code is wrong. |
403 | 50042 | template is empty | Template content is empty |
403 | 50043 | template too long | The content of template is too long and the length of the signature is limited to 350 characters |
403 | 50044 | template parameter invalid | Template parameter is invalid |
403 | 50045 | remark too long | The comment is too long and the length is limited to 500 characters |
403 | 50046 | signature not set | The application does not set signature. Please set the signature first |
403 | 50047 | modify template not allow | Only the template that fails the audit is allowed to modify |