Request

From UBot Studio
Revision as of 20:15, 12 July 2023 by LillyT (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

$request is a function that sends an HTTP request with specified parameters and returns the response in yaml format. This allows you to work directly with any API you'd like.

Parameters

URL: The URL to which the HTTP request is to be made.

Method: The HTTP method to use for the request. The options are "GET", "POST", "PUT", "DELETE".

Data: (optional) The data to send with the request. This should be an object in yaml or json format.

Headers: (optional) Any headers that should be sent with the request. This should be an object in yaml or json format.

Return Value

This function returns the server's response as a yaml object.

Example

ui console view
log($request("https://jsonplaceholder.typicode.com/posts","POST","title: test
body: content
userId: 1","Content-type: application/json; charset=UTF-8"))

The script above sends a "POST" request to the specified URL with the given data and headers. The server's response is then logged.

Personal tools
Namespaces

Variants
Actions
Navigation
Toolbox