HTTP
Built-in step · 1 step
Call any REST or GraphQL endpoint.
To learn when to use these steps, with examples, read Call an API or run code.
Call an API
Call any REST or GraphQL endpoint that Lodol has no built-in step for. Set the method, URL, headers, query parameters, and body, and the response comes back ready for later steps to read. Store an API token as a workspace secret and reference it in a header to make an authenticated call.
Inputs
- URL
urltextRequired - The full address to call, starting with https://. It can be built from workspace values, for example @values.BASE_URL followed by the path.
- Method
methodtext - The HTTP method the endpoint expects.One of:
GET,POST,PUT,PATCH,DELETE,HEAD,OPTIONS. Default:GET. - Headers
headersobject - Headers to send, such as an Authorization header. Use a workspace secret for a token so it is never stored in the workflow.
- Query parameters
queryobject - Values added to the end of the URL as a query string. Anything already written into the URL is kept.
- Body
bodyobject - What to send with the request, as JSON or a reference to a value from an earlier step. Leave it empty for a request that carries no body, such as a GET.
- Body format
body_formattext - How to encode the body. JSON suits most APIs, including GraphQL. Form sends it the way an HTML form would.One of:
json,form,text,none. Default:json. - Response format
response_formattext - How to read what comes back. Auto follows the response's own content type, so JSON becomes an object and a download becomes a file.One of:
auto,json,text,file. Default:auto. - Error responses
on_errortext - What an error status (a 404, a 500) means for this step. Treating it as a result lets later steps check the status themselves, which suits a 404 that just means not found. A request that gets no answer at all still fails the step; the step's own "If this step fails" setting decides what happens then.One of:
fail(Fail the step),continue(Treat them as results). Default:fail.
Outputs
bodyobjectheadersobjectoktrue/falsestatusnumberurltext
Example output
{
"body": {},
"headers": {},
"ok": true,
"status": 1,
"url": "example_value"
}