New knowledge of game API access

First of all, the API full name (Application Programming Interface, application programming interface) is some predefined functions, or the convention of connecting different components of a software system. The purpose is to provide applications and developers with the ability to access a set of routines based on certain software or hardware without having to access the source code or understand the details of the internal working mechanism.

API definition

For many product Xiaobai or job seekers, API is a professional term in the field of product and R & D. you may have touched the concept of API in the article or PRD.

In fact, the application of interface has been very extensive and mature. This concept is mainly active in the connection and docking of various systems within the company and the scene of cooperation between companies. If you can read this article carefully, I believe you will have a deeper understanding of API interface, even more than 90% of Xiaobai and job seekers.

Contents

  1. What is the API API interface of the game?
  2. Why do we need the API API interface?
  3. The core of API API interface

The core of API API interface

At this time, we call y = x + 2 as the interface, x = 2 as the parameter, y = 4 as the return result. The function of this interface is to add 2 to the number we input (Note: Here you can find that the interface itself has logic).

In this way, you can clearly understand the official interpretation of Baidu Encyclopedia. The interface is a predefined function logic, which is used by other systems to request and return results.

2、 Why do we need game API?

Background: our business system involves many aspects. If we want a company or a system to finish all the business, is the workload too heavy? And if other systems or companies have better operational logic, we can consider using interfaces for development when designing functions.

Core requirements: using existing interfaces can reduce development costs and shorten development costs.

For example: for example, I am an app that makes games. Now I need to show the functions of games on my page. For our company, the cost of new development is too high. Then we can access the API provided by the open platform of ngapi interface provider. In this way, we only need to apply for API interface account opening, deploy and call ngapi interface API, so we can quickly launch a rich game platform on our page.

Game API access

3、 The core of API

For Xiaobai, at first glance, the API documents may be confused - where to look, how to look, and what is the problem in front of him.

In fact, for product managers, we should pay more attention to what kind of API services this company can provide. For example, I know that Gaud can provide map API and route planning API, so that we can think of calling their services or references in our design functions and work.

We now have an app that requires users to set up the wechat payment API to complete the purchase. Please enter the scene automatically and regard yourself as a product manager.

1. Interface address

Now, users click to pay. We need to tell wechat that we need to set up your cashier! But where to tell? This requires the interface address, which is equivalent to transferring the specified data to the wechat link.

A link address is not a page we understand, you can understand it is a phone number, Xiaobai people want to change this concept.

At this time, we can see that the interface document tells us that the link is as follows. Then we have already called wechat.

2. Request parameters (message)

Now we need to tell wechat that you want to call the cashier, right. Then we need to write it down. The message generated at this time is called a message, that is, what do you want to tell the content of this interface? Equivalent to the input x = 2 of the previous function.

Generally speaking, the format and content of the message are specified according to the interface document. For example, the following is the message requirements of wechat open platform for starting the cash register.

What is the game API

For example, if you are a merchant, there are three apps a, B and C below, so wechat needs to know which merchant you are and which app below needs to use the cash register. This is very important. After wechat, you need to type the received money into the corresponding account and statistics.

  • ≪ appid & gt; wx2421b1c4370ec43b & lt; / appid & gt; (my app ID is wx2421 ).
  • ≪ MCH & ID & gt; 10000100 & lt; / MCH & ID & gt; (my merchant ID is 10000 ).

OK, now that wechat knows who you are, you need to tell wechat how much money you need to pay for you, right? The currency type and total amount are defined here, that is, what currency and how much money to collect.

What is the game API

Here you can see whether the currency type must be filled in, that is to say, you can also not tell what the wechat payment currency type is, because he noted that the default is RMB later.

  • ≪ Free U type & gt; CNY & lt; / Free U type & gt
  • ≪ total fee & gt; 1 & lt; / total fee & gt

<notify_url>http://wxpay.wxutil.com/pub_v2/pay/notify.v2.php</notify_url>

3. Return results

Just now, wechat payment has gone to collect money. Now he will tell us the result in the notice address we left. There are only two results: successful collection? Collection unsuccessful?

(1) Success

This is the information that wechat tells us after the payment is successful.

What is the game API

App appid, merchant No.: tell you which merchant and which appid transaction I successfully deducted.

Business result: success or failure

(2) Failure

In product design, we often pay attention to failure. When collection fails, wechat will also tell you the reasons for failure, as shown in the figure below. There are many reasons for failure. When designing, we often analyze the reasons for each failure, and design pages and user prompts for the reasons of each failure to ensure that users can understand.

What is the game API

The above is the understanding of the basic operation mode of API. Next, I will continue to update some more in-depth and detailed key elements of API, such as request mode / signature / encryption and decryption, etc.

comment0

  • Nickname (required)
  • Email (required)
  • Website
  • (615+413=?)
Sign in / register
Administrator Login