Announcement: Tencent Cloud Mini Program Platform Renamed to Tencent Cloud Super App as a Service on January 2, 2025
Console Updates
Android SDK Updates
iOS SDK Updates
Flutter SDK Updates
IDE Updates
Base Library Updates
Property | Type | Default value | Required | Description |
url | string | - | True | The URL of the developer's server API |
data | string/object/ArrayBuffer | - | False | Request parameter. |
header | Object | - | False | Sets the request header. Referer cannot be set in the header. The default content-type is application/json |
timeout | number | - | False | Timeout duration in milliseconds. |
certs | Array<string> | - | False | When certificate pinning is enabled, this value is passed in. During the request, the system will verify whether the currently provided value matches the actual public key content of the corresponding domain. For example: ["sha256/FNIJxtRaQACmXyIS+CABwt/8Sc1ffjF5zI3sgKOLusc="] |
method | string | GET | False | HTTP request method. |
dataType | string | json | False | The format of the returned data. |
responseType | string | text | False | The type of the response data. |
success | function | - | False | Callback function for successful API calls. |
fail | function | - | False | Callback function for failed API calls. |
complete | function | - | False | Callback function executed after API call ends (regardless of success or failure). |
Value | Description |
OPTIONS | HTTP OPTIONS request |
GET | HTTP GET request |
HEAD | HTTP HEAD request |
POST | HTTP POST request |
PUT | HTTP PUT request |
DELETE | HTTP DELETE request |
TRACE | HTTP TRACE request |
CONNECT | HTTP CONNECT request |
Value | Description |
json | The returned data is in JSON format and will be parsed once using JSON.parse. |
Others | The returned data will not be parsed using JSON.parse |
Value | Description |
text | The response data is text. |
arraybuffer | The response data is an ArrayBuffer. |
Property | Type | Description |
data | string/Object/Arraybuffer | The data returned by the developer server. |
statusCode | number | The HTTP status code returned by the developer server. |
header | Object | The HTTP response header returned by the developer server. |
cookies | Array.<string> | The cookies returned by the developer server in the format of string array (not supported in mini games). |
Property | Type | Description |
errMsg | String | Error message. |
GET method data, it will be converted to a query string (encodeURIComponent(k)=encodeURIComponent(v)&encodeURIComponent(k)=encodeURIComponent(v)...)POST method data with header['content-type'] as application/json, it will be serialized into JSON.POST method data with header['content-type'] as application/x-www-form-urlencoded , it will be converted into a query string (encodeURIComponent(k)=encodeURIComponent(v)&encodeURIComponent(k)=encodeURIComponent(v)...)wx.request({url: 'test.php', // Example URL, not a real interface addressdata: {x: '',y: ''},header: {'content-type': 'application/json' // Default value},success(res) {console.log(res.data)}})
Property | Type | Description |
res | Object | The response for each new chunk received from the developer's server. |
Structural property | Type | Description |
data | ArrayBuffer | The returned chunk buffer. |
const listener = function (res) { console.log(res) }RequestTask.onChunkReceived(listener)RequestTask.offChunkReceived(listener) // Must pass the same function object used in onChunkReceived
Property | Type | Description |
header | Object | The HTTP response header returned by the developer server. |
statusCode | Number | The HTTP status code returned by the developer's server (currently not returned in the developer tools, but can be viewed on a real device) |
cookies | Array.<string> | The cookies returned by the developer server in the format of string array. |
const listener = function (res) { console.log(res) }RequestTask.onHeadersReceived(listener)RequestTask.offHeadersReceived(listener) // Must pass the same function object used in onHeadersReceived
# Rule: sha256/{base64 value of the certificate public key hash}echo "sha256/$(echo "Certificate public key's hash" | xxd -r -p | base64 | tr -d '\\n')";# How to obtain the certificate public key hash?openssl x509 -in [The server domain name corresponds].crt -pubkey -noout | openssl pkey -pubin -outform der | openssl dgst -sha256 -hex
Was this page helpful?
You can also Contact sales or Submit a Ticket for help.
Help us improve! Rate your documentation experience in 5 mins.
Feedback