What it does
Sends a request to a third-party service through an API connection declared for the project on aukimi.com. Returns a task id.
Syntax
1
ApiRequest(connexion string, methode string, chemin string) → integer2
ApiRequest(connexion string, methode string, chemin string, corps string) → integerParameters
| Name | Type | In forms | Meaning |
|---|---|---|---|
| connexion | string | all | The name of the API connection, as declared on aukimi.com. |
| methode | string | all | The HTTP method: GET, POST, PUT or DELETE, in any case. |
| chemin | string | all | The path to call on the service, such as /scores. It may carry a query string: /search?q=x. |
| corps | string | 2 | Optional request body. Text that reads as JSON is sent as JSON, anything else as plain text. |
Every form returns
integer
A task id for ApiDone(), ApiStatus(), ApiResponse(), ApiJson() and ApiError().
Good to know
- The service's secret key stays on Aukimi's server: the game only knows the connection name.
- The player must be signed in first (PlayerGuestAsync() is enough). Otherwise the task fails at once with
not logged in. - Free the task with ApiFree() once you have read it.
- Editor and HTML5 exports only: native (Bevy) builds stop with an unsupported-command error.
Example · generated
Form 1, the short one
DO Print(ApiRequest("value", "value", "value")) Sync()LOOPForm 2, with every argument
DO Print(ApiRequest("value", "value", "value", "value")) Sync()LOOPApiRequest is called and its answer is printed every frame. The DO … LOOP is not decoration: a classic BASIC program ends the moment it runs out of lines, and Sync() is what draws the frame.