Skip to content

REST API

The REST API node fetches data from any HTTP REST API endpoint using a GET request. Use it to pull data from external services, the WordPress REST API, or third-party APIs.

Configuration

PropertyTypeDefaultDescription
urlstring--Required. The full URL of the API endpoint (e.g., https://api.example.com/items).
headersobject{}HTTP headers to include with the request (e.g., {"Authorization": "Bearer token123"}).
dataPathstring--Dot-notation path to the data array in the response (e.g., data.items or results).
fieldMappingarray--Optional field type hints for schema auto-detection.
orderBystring--Column to sort results by (applied in PHP after fetch).
orderstringDESCSort direction: ASC or DESC.
conditionsarray[]Array of condition objects. Each has field, op, value, and optionally value2 (for BETWEEN). See Table Query: Conditions for full details. Applied in PHP after fetch.
conditionLogicstringANDHow multiple conditions combine: AND or OR.
limitnumber100Maximum rows to return.
offsetnumber0Number of rows to skip.

Input

This is a source node -- it has no input port.

Output

Returns an array of row objects parsed from the JSON response.

json
[
  { "id": 1, "name": "Widget A", "price": 29.99 },
  { "id": 2, "name": "Widget B", "price": 49.99 }
]

How It Works

  1. The node makes a GET request to the configured url using wp_remote_get() with a 15-second timeout.
  2. The JSON response is decoded.
  3. If dataPath is set, the node navigates into the response structure (e.g., data.items extracts response["data"]["items"]).
  4. If the result is a single object (not an array), it is wrapped in an array.
  5. Query options (orderBy, conditions, limit, offset) are applied in PHP on the fetched data.

TIP

This node supports the enhanced conditions system with multiple conditions, AND/OR logic, and operators like BETWEEN, IN, NOT IN, IS NULL, and IS NOT NULL. See the Table Query: Conditions documentation for full details. Legacy single-condition properties (whereField, whereOp, whereValue) still work for backward compatibility.

Data Path

Many APIs nest the actual data inside a wrapper:

json
{
  "status": "ok",
  "data": {
    "items": [
      { "id": 1, "name": "Item 1" }
    ]
  }
}

Set dataPath to data.items to extract the array directly.

Example Use Cases

Fetch from the WordPress REST API

url: "https://mysite.com/wp-json/wp/v2/posts"
dataPath: ""
orderBy: "date"
order: "DESC"
limit: 10

Fetch from an external API with authentication

url: "https://api.example.com/products"
headers: {"Authorization": "Bearer sk_live_abc123"}
dataPath: "results"

Fetch and filter GitHub repositories

url: "https://api.github.com/users/octocat/repos"
dataPath: ""
whereField: "language"
whereOp: "="
whereValue: "JavaScript"
orderBy: "stargazers_count"
order: "DESC"
limit: 5

WARNING

The REST API source node makes a synchronous HTTP request on every page load. For frequently accessed pages, consider caching strategies or using the pipeline deduplication cache (which prevents duplicate requests within the same page render).

TIP

For full HTTP control (POST, PUT, DELETE, custom auth), use the HTTP Request integration node instead.