Docs
Sign in

REST Builder

The REST / API Builder lets you turn a web API into a data source. You describe the API in a small JSON document (where it lives, how to sign in, how it pages through results and where the records are), save it, and APEX Data polls it and lands the records in your project.

Screenshot to add: The REST / API Builder with the source list on the left and the JSON editor on the right.

The page title is REST / API Builder. Its subtitle reads "Define a new REST connector source." for a new source, and "Editing source — read-only view" when you open a saved one. Without an open project the source list says "No project selected — choose one from the sidebar".

The page

AreaWhat it does
Source list (left)Your project's REST sources. Each shows a status dot, its name and its URL. The dot is green for active, amber for pending, grey for paused and red for error
New REST SourceClears the editor so you can start a new source
Name boxThe source name. A New source or Viewing tag sits beside it
JSON editorThe API definition, opened with a starter template
Result barAppears under the editor with an error or a test result

Only sources that use the REST / Poll method are listed. Other kinds, such as Kafka or CDC, are managed from Sources or their own pages.

Create a REST source

  1. Start a new source

    Click New REST Source. The name box is ready to type in, and the editor shows the starter template.

  2. Name it

    Type a Source name…. Save Source stays off until there is a name.

  3. Describe the API

    Edit the JSON in the editor. See Settings for each field. If the JSON is not valid, Save Source turns off and the page shows Invalid JSON under the editor.

  4. Save

    Click Save Source. The editor clears so you can add another, and the source appears in the list.

  5. Test and pull

    Select the saved source in the list, then use Test to check it and Pull to fetch data.

Settings

The starter template is:

{
  "base_url": "https://api.example.com",
  "path": "/data",
  "http_method": "GET",
  "auth_type": "none",
  "auth_token": "",
  "extra_headers": {},
  "query_params": {},
  "records_path": "data",
  "pagination_type": "none",
  "page_param": "page",
  "page_size_param": "limit",
  "page_size": 100
}

Request

SettingMeaning
base_urlThe root address of the API, such as https://api.example.com
pathThe endpoint to call, such as /data
http_methodThe HTTP method. GET by default
extra_headersExtra headers to send with every request, as "Name": "value" pairs
query_paramsQuery-string parameters to send with every request

Authentication

auth_typeWhat to also set
noneNothing. The API is open
bearerauth_token, sent as Authorization: Bearer <token>
api_keyauth_token for the key, and auth_header for the header name. The header defaults to Authorization
basicbasic_user and basic_password

Reading the response

SettingMeaning
records_pathWhere the list of records sits in the response, as a dot path. For {"data": {"items": [...]}} use data.items. Leave it out when the response is the list itself

If an item in the list is not an object, it is stored as a record with a single value field.

Pagination

Set pagination_type to say how the API splits results into pages.

pagination_typeHow it worksSettings it uses
noneOne request onlyNone
pageAsks for page 0, 1, 2…page_param (default page), page_size_param (default limit), page_size (default 100)
offsetAsks for records starting at 0, then 100, 200…offset_param (default offset), page_size_param, page_size
cursorEach response says where the next page startscursor_param (default cursor), cursor_field (the response field holding the next cursor), page_size_param, page_size

Page numbering starts at 0, not 1. Fetching stops when a response comes back empty or has fewer records than page_size. For cursor paging it stops when there is no next cursor or it does not change. As a safety limit, no more than max_pages pages (100 by default) are read in one pull.

Test and pull

With a saved source selected, two buttons appear next to the name:

  • Test calls the API and reports the result below the editor. A green result says Connection successful, with the message and how many sample rows came back. A red one says Connection failed with the reason. If the request itself could not be sent, the message is "Test request failed". Click the small bin icon on the result to dismiss it.
  • Pull queues a job that fetches the data and writes it to the landing zone. Hovering shows "Trigger a pull job — fetches data into Zone 1". The button reads Queuing… while it is sent. The page does not show the job's progress, so check the new data in the Catalog.

Every record that is pulled also gets bookkeeping fields: _ingested_at, _source_id, _source_method, _raw_payload_hash and _event_id.