A small program is not an api; API is the abbreviation of Application Programming Interface, which means application programming interface. The small program is a relatively closed environment. If you want to communicate with external programs, you can use the small program. Program API calls are implemented.
The operating environment of this article: MIUI12.5 system, Xiaomi 11, WeChat 8.0.1.
Is the mini program an API?
A small program is not an API.
API is the abbreviation of Application Programming Interface, which means application programming interface. It is not unique to small programs. Any programming language or program form will have their corresponding API. What I want to talk to you about today is the API of the mini program. The WeChat mini program team has made it easier for developers to develop mini programs. We will talk about some of the more commonly used or underlying methods to encapsulate them and provide them to developers. For human use, this is the interface.
The mini program is a relatively closed environment. If you want to communicate with external programs, you must call the API of the mini program to achieve it. All structures of WeChat mini programs can be obtained from official documents.
Our more commonly used small program APIs are:
1. Network request:
Initiate a request→Download file→Upload file, this is Websocket, this type of API It is the main path for information exchange between the front-end and the back-end. Only through interaction with the server can most business functions be realized. For example, obtaining user information and querying transaction information and order information.
2. Data cache
Change of adding and deleting localstorage. This API is mainly used for small programs to cache local information. For example, registering user credentials will use this type of API. If used well, it can help reduce the pressure on the server.
3. Media category
Media category generally refers to pictures, maps, videos, cameras, recordings, etc. It is officially developed by WeChat to facilitate the majority of developers to process media data. It can be said that it provides convenience for displaying, reading, and storing media content to a large extent, and is the key to realizing the diversification of mini programs.
4. Canvas
Canvas component, which is a component corresponding to H5, is usually used when implementing special image content. For example, it is the more common echart icon. Function, the underlying component to be used is Canvas. It can be said that Canvas helps everyone maximize their imagination and allow a variety of web page designs to be presented.
5. Open interface
What we are talking about here is the plug-in for mini program jump, login, user information, and account information call. It is the only way to realize login and obtain the user's unique identifier openId. It is the basis for realizing all user operations.
Recommended study: "小program Development Tutorial"
The above is the detailed content of Is the mini program an API?. For more information, please follow other related articles on the PHP Chinese website!