This is a short tutorial how to make the first requests with Postman.
Postman is a free collaboration platform for API development and a good way to get started.
The first step is to create an app, which is just another name for project or space.
Click the "New App" button.
Enter a name for your App. The name must be unique so it might already been taken if you use the cloud version. The name can also contain only lowercase letters, numbers and dashes because it will be part of the URLs.
Click the "Create" button.
Your app will show up in your list. Just click your App (1) to move to the next step:
Read more about Apps:
Next create a schema, which is like a database table with fields of different types:
Go to the schemas section of your App.
Click the "+" button.
Choose a name of your schema. Like the App name it is used in URLs, so it must be unique within your App and it cannot be changed later.
Click the "Create" button to create a new schema.
Now we are going to add a new field:
Click the "Add Field" button in the bottom right of the screen.
Ensure that the field type is set to "String".
Enter a field name.
Click "Create and close" to create a new field.
Also ensure that the schema is published. Otherwise you cannot create content for the schema.
If you want to learn more about schemas use the following page:
Add some content to your schema.
Go to the content section of your App.
Select your created schema.
Click the "New" button to create a new content item.
Now you will see the content screen. If you have added more fields it will look differently of course.
Enter some texts or values for your fields.
Click the "Save and Publish" button. By default only published content items are visible in the API. Therefore it is important not to click the "Save" button.
A client represents an application like a mobile app or server application.
We have implemented the OpenID client credentials flow. It is an secure and open standard to protect your APIs and to provide authentication for clients (aka applications) and users. It is also used big big players like Microsoft, Github and Google. When you login to applications using third party logins you have already used it.
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. Then you have to create a new client with a name of your choice.
To acquire a token you have to do the following steps:
Go the setting section of your App.
Go the the clients setting.
Click the "Connect" button.
In this dialog we provide explanations how to connect to your app. For now we connect manually with Postman. Click the first option (1).
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 (2) that is marked with a red dot here.
This token is valid for 30 days, but can be renewed as often as you want.
You can also access a token with a HTTP request using the client id and secret:
$ curl-X POST 'https://cloud.squidex.io/identity-server/connect/token/'-H 'Content-Type: application/x-www-form-urlencoded'-d 'grant_type=client_credentials&client_id=[APP_NAME]:[CLIENT_ID]&client_secret=[CLIENT_SECRET]&scope=squidex-api'
Squidex creates an OpenAPI documentation for your App. We are going to download it to import it to Postman:
Go to the API section of your App.
Click the "Content API" link to open the API docs in a new tab.
The documentation shows all the endpoints that are available for your content. Download the OpenAPI specification file and save it in your file system to import it with Postman.
We have to import the OpenAPI file to Postman. Click the Import button (1) in the file settings and select your file that you have saved before.
You should be able to see your API now:
Go to Collections section.
Select the ContentAPI for your App.
Select the endpoints for your schema.
Select the query endpoint to query all contents items.
Unclick all query parameters.
The last step is to enter you access token:
Go to the Authorization settings of your API.
Paste in your access token.
Send your request with the "Send" button.
You have created your first app, schema and content with Squidex and you have learned how to retrieve the content items.