How to connect Ag interface

Many programmers or developers do not know how to connect Ag and bbin interfaces. This article applies for account opening on Ag and bbin interfaces and connects to successful solutions according to the development documents.

In principle, API interface design generally appears in the detailed design of development. However, as many companies establish open platforms, product managers gradually need to understand API interfaces, especially for platform products, and learn to define interfaces. This article describes what the product manager needs to define and pay attention to in the design interface.

1、 Basic knowledge understanding

When doing interface design, if you are a novice, it is recommended to refer to and understand the interface styles of different open platforms, such as Baidu, Google, Tencent, etc., from which you can find some consensus;

1. Common communication protocols

调用第三方平台接口需要进行系统间的通信,目前常用的协议是http和https;简单理解https是http的加密版,可以将用户到服务端请求的信息进行加密,避免因明文传输被截获而获知用户信息。

基于http协议的接口具有轻量级、跨平台、和跨语言的特点,为了适应不同的开发者,目前各个第三方平台都会提供基于各种常用语言的接口形式,因此大多采用http或https协议;举例,百度、科大讯飞:笔者查阅了百度、 谷歌 、腾讯、阿里的云平台发现在视觉方面均都采用的是https协议;对于视觉,图片数据本身包含的信息就很丰富,尤其是人脸,因此采用https还是有利于保护用户隐私信息的。

2. Request mode of interface

Understanding the request mode of the interface is helpful to understand the interaction mode between the client and the server. The common request modes based on HTTP protocol are post and get; The main differences between the two are as follows:

(1) Intuitive difference: the get request method is to put the request parameters into the URL, and the post method is to put the parameters into the requst body. The direct impact is that the length of the get request parameters is limited, and the post is unlimited; Secondly, get puts parameters into URL, which is less secure than post;

(2) Depth difference: the client and server of get request mode only interact once, and the client of post request mode will interact with the server twice. For example, if the express brother is the client and you are the server, get is like the courier who often comes to your community and knows you to directly deliver the express to your home, and you say thank you to him; Post is like a new courier. Call first and ask if you are at home? You tell him you are at home. After 5 minutes, he will deliver the express to your home. You say thank you to him;

At present, the image recognition interfaces of Baidu, Tencent and Kuangshi all adopt the post request mode.

3. Interface response mechanism

Finally, understand the response mechanism of the interface: synchronous interface and asynchronous interface; A simple understanding of synchronous interface is to return messages to the caller in real time, and asynchronous interface is to delay the return of messages to the caller; Synchronous interface is required for those with high real-time requirements and can only work linearly, and asynchronous interface can be preferred for others; Of course, in different scenarios, the same service interface will be required to be synchronous or asynchronous; Take face registration in face recognition as an example:

(1) brush face payment: take Alipay as an example. Before you use it, you need to collect faces according to the steps. The background will call the face registration to register the current face into the face database and bind with the Alipay account information. This step is usually a synchronous interface, because it will not require users to wait too long before APP, so it is necessary to return the registration success information in time.

(2) Passenger flow system: at present, the passenger flow system used by supermarkets has generally adopted face recognition instead of head shoulder model, which can not only count the number of people, but also count the number of people. For the first recognized stranger face, it is usually required to register into the stranger face database. The face registration here is generally asynchronous interface, Because large supermarkets have hundreds of thousands of customers every day and have no member information for strangers, they do not need to register in real time, as long as they enter the queue and can register within 24 hours of that day;

Summary

以上关于API的接口常识在设计接口的时候,开发一般都会要求产品确定接口的响应机制;其他的开发都会自己完成;但作为开放平台的产品经常会对接开发,多了解些常识既可以跟自己的开发有更多的共同语言沟通,也可以在对接用户的时候可以跟用户的开发简单解释。

2、 Core business field & amp; Interface constraints

Although the product manager does not need to define all the field information of the API, the product manager needs to be clear about the fields related to business requirements.

1. Enter reference

(1) Authentication field information

Calling the third-party platform interface usually requires interface authentication, and the server determines whether the user has the permission to call the interface; Related to the product manager here is the need to design application management as a product, including: application list, application creation, application details, application configuration, application deletion and other operations; Based on Baidu AI platform, the application list is as follows:

Where API_ Account (API account), sign_ Key (API key) and code (encryption signature) are basically the three kinds of access that are automatically generated when creating applications and required for interface authentication_ The token must be obtained by requesting the server through API key and secret key.

(2) Core business field

The product manager needs to specify the field information required in the interface input parameters and the type of field support according to the business needs. Take the dish identification of Baidu AI platform as an example:

Business requirements: identify which dishes are in the picture;

Product requirements:

Input pictures, which are usually in Base64 and URL formats;

top_num,提高接口的通用性,方便用户后续场景扩展,因此支持配置返回菜品数量且排序;

Threshold, open the recognition threshold, which is convenient for users to adjust according to the actual recognition effect and improve the accuracy;

Note: when designing the core business fields of the interface, try to improve the generality of the interface, so as to adapt to more user scenarios, such as top_ The opening of num and threshold, that is, the ability to generalize the interface, will give more initiative to the interface user to configure.

(3) Field information constraints

The field constraint is to ensure the security of the interface, which is provided to the development partners after the product manager and the business party reach a consensus; Still take the above dish identification as an example:

The image needs to limit the file size and resolution size. The file size only needs an upper limit, and the resolution size needs to include an upper limit and a lower limit. The lower limit is to ensure the effect of the algorithm. For example, small targets are easy to fail in target detection;

top_ Num needs to limit the lower limit, which should not be less than 0. There is no upper limit, and all results returned by the algorithm can be accepted;

The threshold is determined according to the format, which can be 0-100 or 0-1;

Note: a little skill in setting parameters. In order to ensure the effect of the algorithm, sometimes the algorithm will set parameters by default, that is, if the threshold set by the user is lower than the default parameter, the input will not be accepted. If the default is adopted, the user will not feel it;

2. Out reference

The calling interface will have the return information. The product needs to define the returned core field information according to the business requirements. This time, taking Baidu AI open platform gesture recognition as an example, the key fields related to the business requirements include:

result_ Num, result, that is, the number of gesture results recognized in a picture and the specific gesture information;

Result is a JSON array, including the category of gesture, the position information of gesture detection box [the bottom layer of general recognition algorithm is detection + recognition], and the confidence of gesture category;

Some of the field information in the result can be increased or decreased according to business requirements, such as the location information of the target detection box, which can be omitted without general business needs;

3、 Interface current limiting

Interface current limiting is also to ensure the security of the system, because sometimes the business party causes a surge in the amount of calls due to business expansion, which is easy to cause server downtime; Current limiting is similar to the fuse of the switch, which ensures that the system can reject the request or queue up when the request exceeds the upper limit of the interface, so as to ensure the safety of the system;

The product manager needs to fully evaluate the business and give a reasonable amount of evaluation, such as TPS (the number of requests processed per second); This will not waste system resources, but also ensure the normal operation of the business;

Note: corresponding to the above interface response mechanism, the synchronous interface generally needs to give the peak TPS and response time, and the asynchronous interface needs to give the daily regulation;

4、 Interface test

Although the interface test is the work of the little sister of the test, and the test content also covers many, as a product, you can simply understand the following contents, such as,

(1) Interface availability, that is, whether the interface can be called normally, return results normally, handle exceptions correctly, return error codes normally, etc;

(2) Business requirements coverage, that is, whether the interface input and output follow the description of product requirements documents;

(3) Boundary rules are followed, that is, whether the interface meets business rules and field constraints;

(4) Performance conditions: generally, the interface needs to pass the pressure test to reach the performance index before going online, including TPS and time-consuming under a certain amount of concurrency;

Official docking starts

1. First of all, we need to apply for API interface. Here we will tell you how to apply step by step

(1) Can be passed directlySelf service application online account openingIn the figure below, if you only want to connect to the Ag interface, for example, you can choose single interface quota registration. On the contrary, if you want to connect to multiple game platforms, you can choose general quota merchant registration. If you want to expand the overseas market, customers other than mainland China can apply for automatic conversion of multi language and multi currency exchange ratesInternational API interface The supported languages and currencies are as follows

[Chinese] [traditional] [Thai] [Vietnamese] [English] and its corresponding language family [currency]

  1. One line only supports one currency
  2. All supported currencies: CNY (RMB)THB(baht)VND(vnd)USD(USD)
  3. All languages supported: zh-CN(Chinese)zh-tw(traditional Chinese)th(Thai)vi(Vietnamese)en(English)
  4. Note here that the international version interface is different from the non international version interface, and its development documents are also different. If you access the international version, you can directly ignore here.

(2) After the application is successfully logged in, you can view your apikey

With the API account and key, you need to add the IP of your own server to bind with your own account, which is also a kind of security authentication. Even if your API account and key are stolen or leaked, others cannot operate their account through the API. This step is also necessary. If yes, no reference will be madeAPI interface white list setting

(3) Next, according to the new interfaceDeveloping documentsTo dock,

ag接口怎么对接?
ag接口怎么对接?

(4) 下面我们来根据问对用api测试工具apipost来测试创建一个AG接口玩家账户,必要字段这里我已经根据文档要求参数填写上

ag接口怎么对接?

(5) Since then, you can see from the figure below that an Ag account has been successfully registered.

ag接口怎么对接?

Later, the subsequent development and debugging can be carried out through documents. The access mode of bbin interface and other interfaces are basically the same. It depends on your needs.

This article mainly coversHow to connect AG. bbin interface AG, bbin interface application for account openingBbin interfaceAccess mode

comment0

请先

Login / registration
Administrator Login