Features/REST API

Connect any REST API

Create GET, POST, PUT or DELETE requests to any external REST API and use the response on your site.

The REST API app lets you define named requests to any HTTP(S) endpoint. Each request has a method, URL, query params, headers and an optional body, and is stored per site. Requests run on the Divhunt server, not in the visitor's browser. The response (JSON) can then be shown in the builder as a data source or exposed as a global variable.

How it works

  • Admin page: Applications > REST API (route /rest). Home lists requests grouped in four columns by method: GET, POST, PUT, DELETE.
  • Each request has: Name (max 70 chars), Request Method (GET=1, POST=2, PUT=3, DELETE=4; anything else falls back to GET), URL/Endpoint (max 300 chars), Key, Source toggle, Variable, Cache, Body Format (RAW or JSON), Body Data, Request Params (key/value list), Request Headers (key/value list), Properties (key/value list), Conditions.
  • Params and headers drop rows where key or value is empty. If no header is set, Content-Type: application/json is sent by default.
  • URL, params, headers and body values are processed as Divhunt variables, so $properties->get('x') style expressions are resolved before sending.
  • Execution: PHP curl with an 8 second timeout and JSON response format. If the response is not JSON the request still succeeds with the message 'Expected JSON, got <type>'.
  • Run API button in the request editor executes the request and shows the response in a Monaco panel ('CURL Response Preview'); a second panel shows a generated cURL command ('CURL Request Preview').
  • Remove soft-deletes the request after a confirm.
  • Access: the sidebar item and quick settings entry only show for clients with the builder.developer permission (or *) whose organization owns the site.

When to use it

  • Show a list of jobs from an external ATS API on a careers page
  • Pull product or pricing data from an internal API
  • Display data from a public API such as weather or exchange rates
  • Send data to a third-party endpoint with POST

Limitations

  • Request timeout is 8 seconds
  • URL max 300 characters, name max 70
  • IP addresses and localhost are not allowed as hosts
  • Responses are expected as JSON

Availability

  • Works in Designer.
  • Included in every plan.
  • Limits: Timeout 8 s; name 70 chars; URL 300 chars; variable 70 chars; key 70 chars

How to use it.

  1. Install the REST API application from Applications
  2. Open REST API from the admin sidebar
  3. Create a request, pick the method and enter the URL
  4. Add params, headers and body as needed
  5. Click Run API to test and check the response preview

Questions.

Do API calls run in the browser?

Which HTTP methods are supported?

Can I send a JSON body?

Related features.

No card needed

Build it today.Pay when it goes live.

Every feature is unmetered while you build. Checkout opens the first time you publish.