Where can I find the API Reference?
The Directus API Reference is a powerful document that shows us the different ways we can query the API, including filters and pagination.
The Directus API Reference is a powerful document that shows us the different ways we can query the API, including filters and pagination. In this article I will cover where you can find the API Reference for Directus and a useful extension that can help with your own collections.
The Directus API Reference is located in their documentation. Use the left navigation to change which aspect of the API to use. For those who can install extensions, there is a custom extension on github that will generate a personalized API Reference based on your collections.
The Directus documentation will cover everything you need to perform API queries on your website but the trick is knowing where to start.
Step 1 Basic Queries
In the Directus documentation expand the navigation section labelled API Reference and click on Items.
This section covers how to query your own collections including creating, updating and deleting records.
Step 2 Filter Rules
This is essential. Click on the filter rules section to find out how you can filter your query to only return records that are relevant to your application and will drastically improve performance.
Step 3 Global Parameters
This section contains other useful paraments such as sort, fields, limit, page/offset and metadata.
With this information you will know exactly how to utilize the Directus API for your needs and query the data efficiently. I strongly recommend using an application like Postman to explore the API and how the data is formatted.
If you have the ability to install extensions to Directus, here is an API Reference extension that will dynamically build a library of queries from your collections and the system collections. An excellent toolkit for an project.