apiRequestByHighway(params: Object)
Requires:
MiniKit≥2.3.6@ray-js/ray≥0.5.9
Platforms:
iOSAndroid
Description
Initiate a highway request
Parameters
| Property | Type | Required | Default | Description | MiniKit Since |
|---|---|---|---|---|---|
api | string | Yes | - | API name | - |
| No | - | Highway API request parameters; field structure is defined by the Highway interface for the specified api | - | ||
method | "OPTIONS" | "GET" | "HEAD" | "POST" | "PUT" | "DELETE" | "TRACE" | "CONNECT" | No | 'GET' | method request method | - |
requestId | string | No | - | requestId request ID, not exposed to business code | v3.27.0 |
| No | - | cache cache configuration | v3.27.0 | ||
complete | () => void | No | - | Completion callback (executed on both success and failure) | - |
success | (params: Object) => void | No | - | Callback on successful API call | - |
fail | (params: Object) => void | No | - | Failure callback | - |
success callback parameters
| Property | Type | Description | MiniKit Since |
|---|---|---|---|
| Raw API response data | v3.2.0 |
fail callback parameters
| Property | Type | Description |
|---|---|---|
errorMsg | string | Error message |
errorCode | string | number | Error code |
| Error extension |
Return Value
None
Valid Values
method
| Value | Description | MiniKit Since |
|---|---|---|
GET | HTTP GET request | v3.4.0 |
POST | HTTP POST request | v3.4.0 |
PUT | HTTP PUT request | v3.4.0 |
DELETE | HTTP DELETE request | v3.4.0 |
ApiRequestCacheBean.policy
| Value | Description | MiniKit Since |
|---|---|---|
NETWORK_ONLY | Only send a network request, do not use cache | v4.24.0 |
CACHE_ELSE_NETWORK | Use cache first; if not present, send a network request | v4.24.0 |
CACHE_THEN_NETWORK | Prefer cache while also sending a network request; the network result will be delivered via events | v4.24.0 |