Some questions about API (two)

The author's last article introduced the API in the HTTP protocol, and then I will introduce the request and authentication of the API.

API data format

At present, most APIs use JSON format. JSON ( JavaScript  Object Notation, JS Object Notation) is a lightweight data exchange format. It is based on   a subset of ECMAScript (the js specification developed by the European Computer Association), and uses a text format completely independent of the programming language to store and represent data. The concise and clear hierarchical structure makes JSON an ideal data exchange language. It is easy for people to read and write, but also easy for machine to parse and generate, and effectively improve the efficiency of network transmission. Most of the original XML format was used.

API authentication method

API has different authentication methods, here we introduce two authentication methods

The first type : simple identity authentication method (APPCODE method):

The identity authentication of the called interface can be realized through APPCODE, and the calling authority to access the related API can be obtained.

Instructions:

1. The Authorization field added in the request header;

2. Configure the value of the Authorization field as APPCODE+half-width space+APPCODE value;

Format: Authorization:APPCODE AppCode value

Example:     Authorization:APPCODE  3F2504E04F8911D39A0C0305E82C3301;

The second type : API signature authentication (AppKey&AppSAppSecret)

AppKey and AppSAppSecret are equivalent to another account and password mechanism of the current account. Suppose we have purchased the API we need on a certain news or a certain cloud, then you can find the AppKey and AppSAppSecret of the API you purchased.

For example:

API call steps:

Obtain API documentation-create application-obtain authorization-call API

Note for API calls:

1. The number of online apps under each account is 10, and the name of the app should be unique under the account.

2. The flow control of calling API is limited to a single IP, and the QPS does not exceed 100. (Queries-per-second (QPS, Queries-per-second) is a measure of how much traffic a specific query server handles within a specified period of time. On the Internet, the performance of a domain name system server often uses queries per second. Rate to measure.)

3. You have the right to operate the purchased API and APP authorization and contact authorization. The service provider authorizes the API of your APP, and you have no right to operate the contact authorization.

4. Your request needs to include signature information.

Guess you like

Origin blog.csdn.net/qq_39530692/article/details/104072752