Motion
Get Motion

ReferenceScripting APIMotionScenefetch

MotionScene.fetch

method

Reads a web address on one of the sites the scene may read (Websites it may read, on the Scene's Script card), when the person allows it.

Namefetch
Kindmethod of MotionScene
Called asscene.fetch(…)
As a nodeSend HTTP Request (logic graph)
Since0.3

Syntax

fetch(    url: string,    options?: { method?: "GET" | "POST" | "HEAD"; headers?: Record<string, string>; body?: unknown }): Promise<MotionFetched>

Parameters

NameTypeDescription
urlstringAn https:// address
options{ method?: "GET" | "POST" | "HEAD"; headers?: Record<string, string>; body?: unknown }Optional. Its method (GET, POST, HEAD), headers and body

Returns

Promise<MotionFetched>: a promise of what it answered.

Remarks

Rejects for an address the scene doesn't name or the person doesn't allow, one on this computer or its network, more than 30 a minute, and answers over 4 MB.

Example

const r = await scene.fetch("https://api.example.com/quote");

See also

MotionFetched