May 20, 2021 WeChat Mini Program Development Document
Note: The HTTP API path trigger cloud function does not contain user information
The Cloud Development HTTP API provides the following cloud function call API:
This interface should be called on the server side, as detailed in the service side API.
Trigger the cloud function. Note: The HTTP API path trigger cloud function does not contain user information.
POST https://api.weixin.qq.com/tcb/invokecloudfunction?access_token=ACCESS_TOKEN&env=ENV&name=FUNCTION_NAME
Property | Type | The default | Required | Description |
---|---|---|---|---|
access_token | string | Is | The interface calls the credentials | |
Env | string | Is | Cloud development environment ID | |
name | string | Is | The name of the cloud function | |
POSTBODY | string | Is | Incoming parameters for cloud functions, the structure of which is defined by the developer. |
The returned JSON packet
Property | Type | Description |
---|---|---|
errcode | number | Error code |
errmsg | string | The error message |
resp_data | string | The buffer returned by the cloud function |
The legal value of errcode
Value | Description | The lowest version |
---|---|---|
0 | The request was successful | |
-1 | System error | |
-1000 | System error | |
40014 | AccessToken is illegal | |
40101 | Required parameters are missing | |
41001 | Missing AccessToken | |
42001 | AccessToken expires | |
43002 | HTTP METHOD error | |
44002 | POST BODY is empty | |
85088 | The APP is not open for cloud development | |
Other error codes | Cloud development error code |
curl -d '{}' \
'https://api.weixin.qq.com/tcb/invokecloudfunction?access_token=ACCESS_TOKEN&env=ENV&name=login'
{
"errcode": 0,
"errmsg": "ok",
"resp_data": "{\"event\":{\"userInfo\":{\"appId\":\"SAMPLE_APPID\"}},\"appid\":\"SAMPLE_APPID\"}"
}