REST API Overview
Last updated: 2019-06-26 10:01:32
Differences Between V3 and V2
V3 is fully based on HTTPS and no longer provides HTTP access.
V3 supports POST access and no longer provides GET access.
V3 uses HTTP Basic Authentication for access authorization. API requests can be done using common HTTP tools such as curl and Postman.
In V3, APIs are categorized according to business functions, including Push API, Tag API, Device API, and Tool API. The same URL is used for all APIs in one category to improve API usability.
V3 has improvements in functionality. A tool API for arrival statistics query is added, which is currently under beta test.
For V2, see the documentation at https://intl.cloud.tencent.com/document/product/1024/30744.
Note: It is recommended to use the V3 APIs, and V2 APIs may be discontinued in the future.
TPNS provides REST-compliant HTTP APIs for developers to remotely call the services provided by it.
The APIs are mainly divided into four categories:
|Push API||It includes various APIs used to push messages||Normal|
|Tag API||It includes various APIs used to add, delete, and query tags||Normal|
|Device API||It includes various APIs used to query and delete account||Implementing|
|Tool API||It includes various APIs used to locate problems and query other data||Implementing|
- HTTPS is supported
- POST is supported
Basic authentication is used, i.e., adding a field (key-value pair) to the HTTP Header:
Authorization: Basic base64_auth_string
The generation algorithm for base64_auth_string is:
That is to add a colon after
SECRETKEYto form a string and then perform
base64encoding on the string.
SECRETKEYcan be obtained in My apps > App configuration at the TPNS website.
|openapi.xg.qq.com||API domain name||None|
|class_path||Category of the API provided||Different APIs have different path names|
|method||Feature API name||Different feature APIs have different names|
- For Push API, the APIs for full push and tag push have limitations on call frequency. The default value is 30 times per ACCESS_ID per hour.
- The size of the pushed message body cannot exceed 4 KB, and this limitation applies to the
messagefield in Push API.