This API should be called on the server side and cannot be called directly on the client side (Mini Program, web page, APP, etc.). For details, please refer to API Call Guide.
API English Name: getUploadTcbFileLink
You can obtain a file upload link via this API. If you encounter any issues, you can post your questions in the Open Platform Service Provider Zone to discuss with the community.
1. Call Method
HTTPS Call
POST https://api.weixin.qq.com/tcb/uploadfile?access_token=ACCESS_TOKEN
Cloud Call
- This API does not support cloud call.
Third-party Call
-
This API supports third-party platforms on behalf of Merchant call.
-
The permission set ID of this API is: 49
-
After the service provider obtains one of the permission set authorizations, it can use authorizer_access_token to call on behalf of Merchant, for details please refer to Third-party Call documentation.
2. Request Parameters
Query Parameters Query String Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
| access_token | string | Yes | API call credential, you can use access_token, authorizer_access_token |
Request Body Request Payload
| Parameter | Type | Required | Description |
|---|---|---|---|
| env | string | Yes | Cloud Environment ID |
| path | string | Yes | Upload Path |
3. Response Parameters
Response Body Response Payload
| Parameter | Type | Description |
|---|---|---|
| errcode | number | Error Code |
| errmsg | string | Error Message |
| url | string | Upload URL |
| token | string | token |
| authorization | string | authorization |
| file_id | string | File ID |
| cos_file_id | string | COS File ID |
4. Notes
No special notes for this API
5. Code Example
Request Example
{
"env": "test2-4a89da",
"path": "this/is/a/example/file.path"
}
Response Example
{
"errcode": 0,
"errmsg": "ok",
"url": "https://cos.ap-shanghai.myqcloud.com/7465-test2-4a89da-1258717764/testupload",
"token": "Cukha70zkXIBqkh1OhUIFqjUmXLXeSWq7dff61099221bb270522b8e0cf21d72e0aWCfGXEIDT5bKVJgykFFr9_MeQ-ExrsZ8oiFdMwyYag8h0r-EJq_EaO94KzksxH6bAeb4Y7SwZjJqoy_4g1Na797F1IEG9Dnstm_rz02AgaP5HbJwt1P-XHT4Xjw_lafla079gtQKAP-EPbE5Tc8BRXIm32esjGDDDuDyml7IJqbsPolYZ4-CHQsisdx488loGAN4f7YRMkrrP1Pgi5XOm0-iG5HbWd3tHtuE2pzsGkTobO_fyz2PfSPaeUt_735ll38yIWpAFESAsZnBj2DcRSPBT2FJ_s5mOZACS53q6-tWXPO0AR3-EhOCQpiDKsldVsCxz00Uwhgm1T6Ozw777fJEFkUIngUdZ5yajy3LA84Mpfu6CLkFjfiBtz3wpmcCQxhijo_CrVHkmaMc2JBQ",
"authorization": "q-sign-algorithm=sha1&q-ak=AKID98EDB528Sfqerp0Z_7l23we-u4Avrx04te9VvlzGihMTseysMgu7iSdh_hxEnoAy&q-sign-time=1557307130;1557308030&q-key-time=1557307130;1557308030&q-header-list=&q-url-param-list=&q-signature=ac95227b67a04157bb5e49b435c6ac3ce88e03f2",
"file_id": "cloud://test2-4a89da.7465-test2-4a89da-1258717764/testupload",
"cos_file_id": "HDze32/qZENCwWi5N5akgoXSv3U8DsccKaqCxTMGs0zFgvlD28j484/VYFPJ1l2QDh0Qy8wNbQCpxs5zEsLJln1lIY9RGYn1LzRQQQYFQm+Xwvw6S4YEZN1AIwY906mwIBgiI3gKGkU2K1+1ZEnEYEM4Uh/C1JxB4Q=="
}
6. Error Codes
The following is the error code list of this API, other error codes can refer to Common Error Codes; When encountering errors in calling the API, you can use the official API Diagnostic Tool to assist in locating and analyzing problems.
| Error Code | Error Description | Solution |
|---|---|---|
| -1000 | system error | System Error |
| -1 | system error | System is busy. Please try again later. |
| 0 | ok | ok |
| 40001 | invalid credential access_token isinvalid or not latest | AppSecret is incorrect, or the access_token is invalid when obtaining access_token. Developers should carefully verify the correctness of the AppSecret or check if they are calling the API for the correct Official Account. |
| 40014 | invalid access_token | Invalid access_token. Developers should carefully verify the validity of the access_token (e.g., whether it has expired) or check if they are calling the API for the correct Official Account. |
| 40097 | invalid args | Parameter Error |
| 40101 | missing parameter | Missing Required Parameter |
| 41001 | access_token missing | Missing access_token Parameter |
| 43002 | require POST method | POST Request Required |
| 44002 | empty post data | POST Data Package is Empty |
| 47001 | data format error | Error parsing JSON/XML content; missing parameters in POST data. Check, correct, and retry. |
| 85088 | no qbase privilege | Cloud Development has not been enabled for this app. |
7. Applicable Scope
This API supports 「Third-party Platform」 account type for proxy calls. For permission sets, please refer to the "Call Method" section. Other account types cannot call unless otherwise specified.