data.to.design now allows you to connect directly to your APIs.
<aside>
For now, we only support a single API request, therefor the request will need to return all the data you wish to use in designs.
</aside>
To set up your dataset, we have two stages: the first is the API configuration for request, and the second is the validation.
To query your API we need the URL of your API, and depending on your API, you may also need to set some additional information. For example, if your API requires a POST request, you can select that and optionally set the POST data payload if needed.
We can support basic search and pagination of your API by specifying special “tokens” that will be replaced before sending a request to your API.
These tokens can be set in the URL, HEADERS or POST data. Those tokens are:
{{search}}
the value will be the search term from within the data.to.design plugin search field
{{sort_key}}
is a desired attribute for your data to sort on
{{sort_order}}
will be either asc
or desc
{{per_page}}
is one of: 50, 100, 150, 200, 250
For example, if your API supports all of these via search parameters in the URL, your API URL may look something like this:
http://api.io?q={{search}}&sort={{sort_key}}&order={{sort_order}}&c={{per_page}}