This guide provides step by step descriptions of how to deal with SPARQUE in Postman based on a demo Postman collection.
You can download the Postman collection here:
To import the Postman collection, follow these steps:
In Postman, click on Import in the Workspace section.
Add the downloaded file.
Click on the Import button under Import Elements.
To get an access token within Postman, follow these steps:
Create a new request for the Spinque Query API call you want to do, for example “https://rest.spinque.com/4/my-workspace/api/my-api/e/my-endpoint/results?config=default&count=30”.
Under Authorization, click the Type drop-down and select “OAuth 2.0”.
Make sure Add auth data to is set to “Request Headers”.
To the right, scroll down to Configure New Token.
Under the Configuration Options tab, add a name for your new token. This can be anything you want.
For Grant Type, select “Client Credentials”.
For Access Token URL, fill in “https://login.spinque.com/oauth/token”.
Fill in your Client ID and Client Secret in the next two fields.
You can find them within the member settings - system user.
Leave the Scope empty.
Set Client Authentication to “Send client credentials in body”.
Open the Advanced Options tab.
Set Audience to “https://rest.spinque.com/”.
Click the Get New Access Token button and, if successful, click Proceed and then Use Token.
Now click Send to send the request to the Spinque Query API.
The token has a validation of 24hr. After this time you will need to repeat step 13 and step 14.
For changing variables, follow these steps:
Click on the collection “Demo”.
Go to the tab Variables.
Change the variables in the things you need, for example
workspace (the name of your workspace, this is used for the API path)
API (the name of your API set which you configured within the workspace)
keyword (in most cases the word which is used for search)
etc
You can test all APIs at once. To do so, follow these steps:
Click on your collection (for example “Demo”).
Navigate to tab Runs.
Click on Run Collection.
Click on the button Run {{your collection name}} which is in the demo example Run Demo.
By default, Postman will collect all HTTP statuses, it will not store the response itself (because of performance). You can change this setting:
Before running your collection (Run Demo), click on Advanced settings.
Make sure Save responses is set.
Click on Run Demo.