Skip to content

HTTP Request ​

The HTTP Request block sends a request to another web service, waits for the answer, and passes that answer on. Use it to fetch data from an API or to send data to one.

When to use it ​

  • Read data from a third-party API, like weather, payments or a CRM.
  • Tell another service something happened: post to a webhook, create a record, start a job.
  • Don't use it to start another Fluxify workflow. Trigger Workflow does that without a network call.
  • Don't use it to read your own database. The DB blocks are faster and safer for that.

Inputs ​

FieldRequiredDefaultWhat it does
URLYesnoneThe address to call. Can be a JS expression, for example js: 'https://api.example.com/users/' + input.id.
MethodYesnoneGET, POST, PUT, DELETE or PATCH.
HeadersNononeExtra information sent with the request, like an Authorization token. Names and values can be JS expressions.
BodyNoemptyThe data to send. Only used by POST, PUT and PATCH. Values inside can be JS expressions.
Use ParamNooffOn: send the previous block's output as the body, instead of the Body field.
Save output to variableNooffStore the result in outputs.<name>.

Use App Config for secrets like API keys, instead of typing them into a header.

Outputs ​

HandleWhen it is used
Next (right)The request succeeded. The next block receives { data, status }.
FieldWhat it holds
dataThe answer's body. JSON is already turned into an object or list.
statusThe HTTP status code, for example 200.

Example ​

Look up a user from an API. The previous block output { "id": 7 }.

FieldValue
URLjs: 'https://api.example.com/users/' + input.id
MethodGET
HeadersAuthorization = js: 'Bearer ' + getConfig('API_KEY')

Result passed to the next block:

json
{ "data": { "id": 7, "name": "Avery" }, "status": 200 }

Use input.data.name in the next block.

How it behaves ​

  • A failed call is an error. A network problem, or an answer with an error status like 404 or 500, fails the block. The Error Handler runs instead of Next.
  • Only success continues. To react to a specific status, let the Error Handler take over, or call the API from a JS Runner and check the status yourself.
  • JSON text is parsed. If the body is text that is valid JSON, it is sent as JSON.
  • No timeout of its own. The call waits as long as the route's own timeout allows.
  • A relative URL like /health is sent to http://localhost:3000, which is usually not what you want. Use the full address.
  • Your previous data is replaced. The next block's input is the response, not what came before. Use Save output to variable or Set Variable to keep earlier data.

Released under the Apache License 2.0. Enterprise features are under the Fluxify Enterprise Edition License.