Configuration
Calling OSAIS APIs and getting called back on specific end points
Last updated
Calling OSAIS APIs and getting called back on specific end points
Last updated
A Client Token is required to call OSAIS via APIs, as opposed to just using the User Interface for interacting with AIs.
As a subscribed user, you can create multiple client tokens, one per domain on which you would like to get called back.
Go to your Profile, and then select the tab Settings.
You will only be able to create a Client Token if your have a valid subscription.
If you have the right authorization, then a button [Add a Client Token] will appear. Click the button to go to the settings page of the Token. A dialog will appear.
Enter the domain, and then the uriNotify and the uriUpload. Make sure you DO NOT add the domain name again in the uris, otherwise the callbacks will not work!
If you are on a test environment with an nGROK for example, then make sure that you update your nGROK domain in the [domain] filed each time you renew it. Otherwise, the call would end up calling another nGROK endpoint than yours.
When all in entered correctly, press [Create]. You will be redirected to the settings page, and will see the details of your Client Token.
Copy your token and your secret, and use them in your application.
The [Not Yet Validated] signal will turn to [validated] as soon as you make a first call to an AI, and that your notification is properly received and acknowledged.
We have provided a full sample app to show the integration of OSAIS into a NodeJS backend. Use this sample app as a backbone sample for your own implementation.
Make a call to the PING AI, via the specific API call, in particular a call to https://opensourceais.com/api/v1/private/client/ai/ping
If all is configured correctly, your notification endpoint (in our example above myapp.com/public/notify) will get called with some parameters.
Your upload endpoint will also get called with the file which was generated by the AI.
The generic parameters received in a notification are as follows:
It is likely that during testing, you may have to change many times the Domain configuration, for example if you are using an nGROK. To facilitate the update, there is an API for an authenticated Client to update its own parameters (i.e. here in our case, the domain).
PATCH
https://opensourceAIs.com/v1/private/client
Name | Type | Description |
---|---|---|
domain
String
the new domain, e.g. "mydomain.com"
uriNotify
String
The new notify URI, e.g. "public/notify"
uriUpload
String
The new upload URI, e.g. "public/upload"