Postman
A Short Tutorial On How to Use Squidex with Postman.
Last updated
A Short Tutorial On How to Use Squidex with Postman.
Last updated
This documentation is based on the FoodCrunch use case. Please open the link below alongside this page to understand the examples.
This is a short tutorial detailing how to create first requests using Postman.
Postman is a free collaboration platform for API development and a good way to get started.
Postman
A Squidex App
If you do not yet have an App, you can refer to one of the quick start guides to create an App that has a pre-defined schema and sample content.
Alternatively, if you wish to create an app from scratch and learn how to create a schema and add content then the following link is a good place to start.
A client represents an application such as a mobile App or server application.
We have implemented the OpenID client credentials flow. It is a secure and open standard to protect your APIs and to provide authentication for clients (aka applications) and users. It is also used by big brands such as Microsoft, GitHub and Google. You've already used it in the past, when you've logged into applications using third party logins.
By default, a default client is generated for your App. If this is not the case, you are probably running an older version of Squidex. If this is the case, you have to create a new client with a name of your choice.
To acquire a token you should perform the following steps:
Go to the Settings (1) section of your App, select Clients (2) under Security and then click the Connect (3) button.
Next, we provide explanations on how to connect to your App. For now, we must connect manually with Postman. Click the first option i.e. Connect manually (4).
In the next step, you see the token that is generated for you and how to use it. Just copy the token by clicking the copy-button (5) as shown in the screenshot below:
This token is valid for 30 days, but can be renewed as often as you want.
You can also access the token with an HTTP request using the Client ID and Client Secret as below:
Squidex creates an OpenAPI documentation for your App. We are going to download it in order to import it to Postman:
Go to the API (1) section of your App and click the Content API (2) link to open the API docs in a new tab.
The documentation shows all the end points that are available for your content. Download (3) the OpenAPI specification file and save it in your file system to import it with Postman. The file is called swagger.json
.
Next, you need to import the OpenAPI file to Postman. To do this, launch Postman and click the Import (1) button in your Workspace (or alternatively click File and then Import).
Next, select the downloaded file (2) that you have saved before.
Select Postman Collection (3) (this should be selected by default) and click Import (4).
You should be able to see the API now.
We are now ready to make requests using Postman. To make a request:
Go to the Collections (5).
Select the ContentAPI (6) for your App, its called Squidex API in this example
Select the endpoints for your schema (7). In our example there are two schemas and the magazine schema is selected.
Next, select the query endpoint (8) to query all content items.
Uncheck (9) all query parameters.
The last step is to enter you access token:
Click the Authorization (10) tab.
Ensure Type (11) is OAuth 2.0
.
Paste in the Access Token (12).
Send your request with the Send (13) button.
You should see a response body which is the result of the GET request.
You have just learnt how to retrieve the content items using Postman!