![]() ![]() It's worth familiarising youself with the API Documentation. If you want to use GraphQL, the URL is always the same. If you're using REST API, the URL will look like this where is your domain name for Directus and articles is your collection in Directus. Give the Request a meaningful name then add the URL for the Directus API. Right click on the collection in you left navigation or click the ellipsis menu icon when you hover the mouse on the collection. Now that you have a collection, you can create some requests. You can add as many collections as you need and you can add multiple Directus projects with ease. If the save button is not showing you need to close the right-side panel. Paste the token from the Directus API and click Save. Next, change the Authorization type to Bearer Token.Ī Token field will appear. To create a new collection, click the + (plus) symbol next to the Collection menu button then name your collection. In this cas you can call it Directus, or something relative to the project. In Postman it's important to create a collection for each service. Important: Whenever a new collection is created, you'll need to update the API role with the required permission. It's very tempting to use the Administrator privilages, but it's definately worth having a dedicated API Role. It keeps you data safe from accidental or deliberate changes that cause havoc on your system. Permissions are a very important part of APIs. There are some great token generators on Google. If empty, type a token now and save the user. At the bottom of the API user, there is a field labelled Token. If you haven't created an API user, create a new user now. Login to Directus and open the User Management module. Lastly, add some endpoints and test the queries. In this article, I'll cover how to connect Postman to Directus.įirst, obtain your Static API token from Directus and set up the Bearer Token in Postman's Authentication, then familiarise yourself with the API documentation. You can connect to any API then test out the various endpoints and responses.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |