Use Swagger for syncing context items from an SQL database
What’s the Swagger interface?
The Swagger interface is a graphical UI to perform API calls to the TrendMiner server in a fast, structured way. It offers the convenience of listing all available API endpoints in one place, with the option to rapidly execute them and retrieve the responses, without any coding or the need for 3rd party tools like Postman involved.
How to use the Swagger interface?
To navigate to the Swagger interface, the first order of business is to find the right service you’re trying to use. For example, to configure Context SQL synchronizations, the service is called context-sql-sync, and the Swagger UI can be found at:
<TM-URL>/context-sql-sync/swagger-ui.html
The next thing is to authorize Swagger to perform API calls. This is done through the Authorize button found near the top of the webpage.

There are several options available to authenticate. For more general information on authentication, please refer to the developer website, e.g.
https://developer.trendminer.com/context-api/#_authentication
One simple option is to use “client_credentials”. These can be created in ConfigHub in the Security > Clients menu. Copy-paste the client id and client secret in the text fields and authorize Swagger. If it was successful, the Authorize button below the text fields will change to “Logout”. You can now close the popup and use any API that the client is authorized for.

Now, select the API you want to use and click the “Try it out” button on the right hand side.

Fill out any required inputs and hit execute. Successful responses will typically range in the 200’s and show a server response. Typical errors such as 401 (unauthorized) could indicate you do not have permission to perform the operation.
