External
Fetch
Name: Fetch
Type: varies
Fetch data from an external HTTP API.
Param
Type
Required
Default
url
string
yes
method
string
no
GET
headers
map<string, string>
no
body
varies
no
interval
integer
no
0
use Fetch from hexagate;
struct Result {
field1: string,
field2: integer,
field3: list<integer>,
};
struct Body {
prop1: bool,
prop2: string,
};
source result: Result = Fetch<Result> {
url: "https://some.url.to/your/api",
method: "PUT",
headers: map(
"Some-Header": "some_value",
),
body: Body {
prop1: true,
prop2: "something"
},
interval: 10,
};
invariant {
description: "Fetch only a string",
condition: Fetch<string> {
url: "http://this.is.a.third/url?cool=wow",
body: 12345,
} == "some string"
};Last updated