HTTP requests
These offer a fast way to load external data from REST APIs, via a configurable interface.
Adding a query via the HTTP Request editor
Adding a query parameter
Body
You can configure the request body in this tab. This may be of the following types:
x-www-form-urlencoded
: The body consists of key value pairs that are encoded in tuples separated by&
, with a=
between the key and the value. The UI allows you to define the key value pairs. The requestcontent-type
will be set toapplication/x-www-form-urlencoded
.raw
: The body can be freely defined as text. Thecontent-type
is selectable from the dropdown.
GET
requests do not have a request body
Adding a request body
Adding a request header
Adding a response parse format
Transforming the response via JavaScript
Parameters
To be really useful, you need to connect these queries with data present on your page. You can do so by creating parameters.
You can define these in the interface available in the HTTP Request query editor. You can bind a parameter to any value available on the page, and the parameter can be bound to any value in the query.
Creating a parameter and binding it
Using the parameter in the query URL
Secrets handling
Toolpad has access to the environment variables defined in the .env
file at the root of the project.
You can connect to environment variables inside HTTP request queries. For example, you can define an Authorization
header and bind it to a value from your environment variables:
Using an environment variable in the request header