Skip to main content

get

Fetches a resource from the specified URL and returns the response as text, JSON, or a base64-encoded string depending on the provided mode. This function performs an asynchronous network request and throws an error if the response status is not successful.

def get(
url: string,
mode: string
) - > string|object

Fetches a resource from the specified URL and processes the response body based on the requested mode.

Parameters

NameTypeDescription
urlstringThe absolute or relative URL of the resource to fetch.
modestringDetermines the parsing strategy for the response: 'text' for plain text, 'json' for object parsing, or any other value for Base64-encoded binary data.

Returns

TypeDescription
`stringobject`