DRAGOPS
DRAGOPS
DocumentationGuidesMake HTTP requests

Make HTTP requests

Call external APIs with authentication, headers, and response handling.

The HTTP Request node is the primary way patterns interact with external services. It supports all standard HTTP methods, custom headers, request bodies, and returns the response status code, headers, and body. This guide covers everything you need to make reliable API calls from your patterns.

HTTP Request node overview

Input pins

PinTypeDescription
MethodStringThe HTTP method: GET, POST, PUT, PATCH, or DELETE
URLStringThe full URL to send the request to
HeadersObjectKey-value pairs for request headers
BodyStringThe request body (typically JSON)

Output pins

PinTypeDescription
Status CodeIntegerThe HTTP status code (200, 404, 500, etc.)
Response HeadersObjectThe response headers as key-value pairs
Response BodyStringThe raw response body as a string

Make a simple GET request

  1. Right-click on the canvas and search for "HTTP Request".
  2. Add it to the canvas.
  3. Select the node to open the Inspector Panel and configure:
    • Method: GET
    • URL: https://api.github.com/repos/octocat/Hello-World
  4. Wire the execution flow from your trigger node to HTTP Request.

The response body arrives as a raw string. To work with it as an object, wire it into a JSON Parse node. See Work with JSON for details.

Send a POST request with a JSON body

To send data in the request body:

  1. Add an HTTP Request node and set the Method to POST.
  2. Set the URL to the target endpoint.
  3. Build the request body using Set Property and JSON Stringify nodes, or use a String literal with the JSON content.
  4. Wire the JSON string to HTTP Request's Body input pin.

You also need to set the Content-Type header so the server knows the body is JSON.

Setting headers

  1. Add a Set Property node.
  2. Set the Key to Content-Type.
  3. Add a String literal with the value application/json and wire it to Set Property's Value input pin.
  4. Wire Set Property's Object output pin to HTTP Request's Headers input pin.

Add authentication

Most APIs require authentication. The two most common patterns are API keys in headers and Bearer tokens.

API key in a header

Some APIs expect an API key in a custom header (for example, X-API-Key).

  1. Add a Set Property node. Set the Key to X-API-Key.
  2. Add a String literal with your API key value and wire it to Set Property's Value input pin.
  3. To add the Content-Type header as well, chain a second Set Property node with the key Content-Type and value application/json.
  4. Wire the final Set Property's Object output pin to HTTP Request's Headers input pin.

Bearer token

APIs that use OAuth or JWT tokens expect an Authorization header with a Bearer prefix.

  1. Add a Format node with the template Bearer {0}.
  2. Wire your token value (from a variable, a connection, or a previous API response) to Format's first input.
  3. Add a Set Property node. Set the Key to Authorization.
  4. Wire Format's Result to Set Property's Value input pin.
  5. Wire Set Property's Object output pin to HTTP Request's Headers input pin.

For reusable credential management, consider using connections instead of hardcoding tokens.

Handle the response

Check the status code

Not every HTTP response is a success. Use a Branch node to check the status code before processing the body.

  1. Add an Equal node. Wire HTTP Request's Status Code to the first input and set the second input to 200.
  2. Add a Branch node. Wire Equal's Result to Branch's Condition input pin.
  3. Wire the True path to your success logic.
  4. Wire the False path to your error logic.

Parse the response body

The response body is a raw string. To extract fields, parse it first:

  1. Add a JSON Parse node and wire HTTP Request's Response Body to its String input pin.
  2. Add Get Property nodes to extract the fields you need.

Error handling with Try / Catch

HTTP requests can fail for reasons beyond bad status codes — network timeouts, DNS resolution failures, or connection resets. These raise errors that stop the execution. Wrap HTTP Request in a Try / Catch to handle these gracefully.

For transient failures, combine Try / Catch with a Retry node:

See Handle errors for a full guide on error handling nodes.

Example: Call an API with auth and process the response

This pattern receives a webhook with a GitHub username, fetches the user's profile from the GitHub API, extracts their public repository count, and logs the result.

Pattern layout

Step-by-step

  1. On Webhook receives {"username": "octocat"}.
  2. Get Property extracts "octocat".
  3. Format builds the URL https://api.github.com/users/octocat.
  4. Set Property creates a headers object with the Accept header.
  5. HTTP Request sends a GET request to the GitHub API.
  6. JSON Parse converts the response body from a string to an object.
  7. Get Property extracts the public_repos field.
  8. Format builds the message: octocat has 8 public repositories.
  9. Log writes the result to the console.

Test the pattern

  1. Select Run in the toolbar.
  2. Enter the test event data:
{
  "body": { "username": "octocat" },
  "headers": {},
  "query": {},
  "method": "POST"
}
  1. Verify the console shows the formatted repository count message.

What is next?

On this page