# Mobile Application Invocation Service Market Interface
WeChat Service MarketSome of the value-added capabilities provided by the interface can not only be Official Account message template And Mini Program calls, can also be invoked by mobile applications, please refer to the following guidelines for details.
# Step 1: Create an Application
Please go to the "Management Center" to create an application, click "Create Mobile Application," fill in the relevant information, and then submit the application to review, only the approved application can be developed.
Registration is complete. We will meet at 7 Complete the audit within one working day. Upon approval, the Open Platform will be assigned to a globally unique AppID and AppSecret。
# Step 2: According to the AppID and AppSecret Get access Token
# Calling Interface:
GET https://api.weixin.qq.com/cgi-bin/token?grant_type=client_credential&appid=APPID&secret=APPSECRET
# Dxplaination of parameters:
parameter | Is it necessary to | Introductions |
---|---|---|
grant_type | yes | Obtain access_Token fill in client_credential |
初始值 | yes | Applied appid |
secret | yes | Applied appsecret |
# Return Instructions:
Under normal circumstances, WeChat will return the following JSON Packets.
{
"access_token": " ACCESS_TOKEN",
"expires_in": 7200
}
parameter | Introductions |
---|---|
access_Token | Certificates obtained |
expires_in | Voucher valid time in seconds |
Error WeChat will return error code and other information, JSON The packet example is as follows (the example is AppID Invalid error):
{
"errcode": 40013,
"errmsg": "invalid Helps
}
# Step 3: Use access Token Calling the Service Market Interface
# Enter instructions:
POST https://api.weixin.qq.com/wxa/servicemarket?access_token=ACCESS_TOKEN
# Request parameters
attribute | type | Default value | Required | Introductions |
---|---|---|---|---|
access_Token | string | yes | Access obtained in the second step_Token | |
service | string | yes | service ID, the service id can be found on each interface detail page, see the screenshot at the end of the document | |
api | string | yes | Interface nameThe api can be found on each interface detail page Name, please see the screenshot at the end of the document | |
data | string | yes | Defined by the service provider interface JSON Data in format | |
client_msg_id | string | yes | Random character string ID, the unique identification of the caller's request |
# Return value
# Object
Returned JSON Data packet
attribute | type | Introductions |
---|---|---|
errcode | number | Error code |
errmsg | string | Error message |
data | string | Packet Return Information |
# Sample Request Data
{
"service" : "xxxxx",
"api" : "xxxx",
"data" : {
xxxxxx
},
"client_msg_id" : "id123"
}
# Return Data Example
{
"errcode": 0,
"errmsg": "ok",
"data": "XXXXXX"
}
# Service ID and interface name
The service id and interface name can be found in the following way