API token
We provide an API token management system in the admin console where admins can create and manage API tokens. These tokens can then be integrated into any external application to initiate a subscription job, refresh a semantic data input model, or both. This way, any authorized user can start a subscription job or refresh the semantic model with a simple click of a button from an external application without logging in to the admin console or the report.
Let us now see the process of creating an API token.
1. Create API Token
To create a new API token, click Create API Token in the API token screen.
![](https://docs.inforiver.com/~gitbook/image?url=https%3A%2F%2F3062809325-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252FEbkCXCUXmtUq5tcnUtZE%252Fuploads%252F01nPcos9I0oZSNmpxdUH%252Fimage.png%3Falt%3Dmedia%26token%3D6e84eba2-dc68-47ee-a95a-8e0a358f74a7&width=768&dpr=4&quality=100&sign=3384215c&sv=1)
In the next screen, you can enter the details of the token.
Token name: Enter a name for the token.
Expiry: Set the token's validity to 30/60/90 days, or you can set any custom date within a year.
Description: Enter an optional description of the token.
Permission: You can set either or both of the following permissions: execute a new subscription, and refresh a semantic data input model.
After entering the details, click Generate.
![](https://docs.inforiver.com/~gitbook/image?url=https%3A%2F%2F3062809325-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252FEbkCXCUXmtUq5tcnUtZE%252Fuploads%252F9gNrY2Iqq1PDKJaxa9Ow%252Fimage.png%3Falt%3Dmedia%26token%3Df779fcf0-64b0-4bad-bc9e-2dc926aff7b6&width=768&dpr=4&quality=100&sign=7c19f9f3&sv=1)
A new token will be generated. Ensure it is copied, as it becomes irretrievable after closing the window.
![](https://docs.inforiver.com/~gitbook/image?url=https%3A%2F%2F3062809325-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252FEbkCXCUXmtUq5tcnUtZE%252Fuploads%252FMZ37MhNEFyGVScIOkqZa%252Fimage.png%3Falt%3Dmedia%26token%3Decf59fb5-3bd4-4286-8cd8-f54865bda711&width=768&dpr=4&quality=100&sign=85fa757f&sv=1)
Now with this token, we can initiate a scheduled subscription and refresh the semantic data input model externally from any application.
2. Trigger subscriptions from external applications
By integrating the created API token into the required application, you can create an API that triggers the required subscription job. Let us now demonstrate this with the help of the Postman application.
You can choose the required subscription from the subscription list or create a new one. Let us run the subscription shown below using the API token.
![](https://docs.inforiver.com/~gitbook/image?url=https%3A%2F%2F3062809325-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252FEbkCXCUXmtUq5tcnUtZE%252Fuploads%252FC8tiQFlHXdINddnd2tuf%252Fimage.png%3Falt%3Dmedia%26token%3D85967fa8-c03c-4221-85ca-32f1d08029f1&width=768&dpr=4&quality=100&sign=5550441c&sv=1)
We will now trigger the subscription job using Postman.
![](https://docs.inforiver.com/~gitbook/image?url=https%3A%2F%2F3062809325-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252FEbkCXCUXmtUq5tcnUtZE%252Fuploads%252FjdEpvNNnSWgDnCDn1kmo%252Fimage.png%3Falt%3Dmedia%26token%3Daa506bf7-362f-412d-9690-40b0b750a6c2&width=768&dpr=4&quality=100&sign=1b396fcd&sv=1)
![](https://docs.inforiver.com/~gitbook/image?url=https%3A%2F%2F3062809325-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252FEbkCXCUXmtUq5tcnUtZE%252Fuploads%252F5koyXELZRVw95Lxfe26z%252F9.1.2..png%3Falt%3Dmedia%26token%3D9aa2ab46-704e-4a42-8d86-adb273a97b0f&width=768&dpr=4&quality=100&sign=c4128e4f&sv=1)
The report is delivered to the intended recipients as scheduled.
![](https://docs.inforiver.com/~gitbook/image?url=https%3A%2F%2F3062809325-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252FEbkCXCUXmtUq5tcnUtZE%252Fuploads%252FXgYG9MwpKf7OJ334rRPq%252Fimage.png%3Falt%3Dmedia%26token%3D83bb809d-ba38-411c-a8bf-4baa3fac9cd8&width=768&dpr=4&quality=100&sign=fdf6e9ed&sv=1)
3. Refresh semantic data input source using API
Inforiver also provides an API to refresh single-select and multi-select dropdowns that use semantic data models. You can generate API tokens from the admin console and trigger ad-hoc semantic model refreshes using the API.
To generate the token, in the API token management screen, check the ‘Refresh Semantic Data Input’ option and generate the token. The token needs to be saved to a file for future access.
![](https://docs.inforiver.com/~gitbook/image?url=https%3A%2F%2F3062809325-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252FEbkCXCUXmtUq5tcnUtZE%252Fuploads%252FDuJb577kFEQHxk2GUrwz%252F9.2.1.%2520sync%2520refresh%2520data%2520input%2520model-1.png%3Falt%3Dmedia%26token%3D0fd94e5b-6b07-458a-86e7-09e2b14a3ae9&width=768&dpr=4&quality=100&sign=c4169b74&sv=1)
The sample report has a single-select data input column and uses a semantic data input model. Instead of a scheduled refresh, the semantic model is set to be refreshed manually by the user when required.
![](https://docs.inforiver.com/~gitbook/image?url=https%3A%2F%2F3062809325-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252FEbkCXCUXmtUq5tcnUtZE%252Fuploads%252Fya4MT7YGn7ogGiL6MEKw%252Fimage.png%3Falt%3Dmedia%26token%3D0dc12b76-d1c2-4986-82f3-e10d779706c0&width=768&dpr=4&quality=100&sign=6c0ffc3f&sv=1)
After creating the single select, navigate to manage measures and edit the single select. You'll be able to see a Refresh Link in the Options section - this is the API endpoint.
![](https://docs.inforiver.com/~gitbook/image?url=https%3A%2F%2F3062809325-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252FEbkCXCUXmtUq5tcnUtZE%252Fuploads%252FFLICCuNlZfRcsr6bKapM%252Fimage.png%3Falt%3Dmedia%26token%3De3f72665-0b1a-4deb-848d-1c3a329fa8a1&width=768&dpr=4&quality=100&sign=9dc7b095&sv=1)
Let's trigger the semantic data model refresh, as demonstrated below using Postman. Use the token generated in STEP 1 in the admin console for authorization. You need to pass the semantic-refresh=true parameter to the API endpoint.
![](https://docs.inforiver.com/~gitbook/image?url=https%3A%2F%2F3062809325-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252FEbkCXCUXmtUq5tcnUtZE%252Fuploads%252FAmwCwYMZFmOsS3qgsxVv%252F9.2.3.%2520sync%2520refresh%2520data%2520input%2520model-1.1.png%3Falt%3Dmedia%26token%3D99132e09-58f5-4254-a688-82170eb5fd32&width=768&dpr=4&quality=100&sign=9f6f3a90&sv=1)
The dropdown options are refreshed with the latest values from the semantic model.
![](https://docs.inforiver.com/~gitbook/image?url=https%3A%2F%2F3062809325-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252FEbkCXCUXmtUq5tcnUtZE%252Fuploads%252FUKtTMTGnOn2HidV9VcvL%252Fimage.png%3Falt%3Dmedia%26token%3D95e5b7fd-8d2a-4fc1-bdc7-51c202d18883&width=768&dpr=4&quality=100&sign=7aae5963&sv=1)
Last updated