Backend APIs

Mini Program provides a set of APIs, such as getAccessToken or code2Session, that are called by using HTTPS requests on the backend server, to help developers analyze, manage, and query various data on the backend. For details, see API documentation.

access_token

access_token is the globally unique credential for calling backend APIs on Mini Programs. It is required for calls to most backend APIs. Developers can obtain it via getAccessToken and save it properly.

To ensure the security of access_token, backend APIs cannot be directly called in a Mini Program via wx.request. This means api.weixin.qq.com cannot be set to a server domain name. Developers should obtain access_token on the backend server via getAccessToken before calling related APIs.

Request Parameters

  • For GET requests, the request parameters should be written as QueryStrings in URLs.
  • For POST requests, some parameters (generally access_token only; other related parameters are reflected in the URLs in the documentation) should be written as QueryStrings in URLs, and other parameters are written as JSON strings in the body of POST requests unless otherwise specified.

Response Parameters

Note: Some APIs do not return errcode or errmsg when they are successfully called, unless they failed to be called.