@http:fetch
Fetch a URL and return the response body as a string.
Returns: string
Syntax
Section titled “Syntax”@http:fetch(url method? body? auth?)Arguments
Section titled “Arguments”| Name | Type | Description |
|---|---|---|
url |
string |
Request URL |
[method] |
string |
HTTP method (GET, POST, etc.) |
[body] |
string |
Request body (JSON string) |
[auth] |
string |
Authorization header value |
Examples
Section titled “Examples”# Simple GET requestset $response @fetch("https://test.evmcrispr.local/hello")print $response
# POST with a bodyset $response @fetch("https://test.evmcrispr.local/echo" POST "payload")print $responseSee Also
Section titled “See Also”- @http:json — parse JSON response
- @http:json.format — build JSON request body