Accessing the API
Last updated
Last updated
To call Cubu’s S2S API, follow these steps:
Create a Registered Application in Cubu. A registered application represents the 3rd party application calling the API.
Use the registered application's client ID and client secret to generate an access token.
Use the access token when calling API endpoints.
Cubu allows you to create up to 5 registered applications in your organization.
In Cubu, go to Admin tools > Settings > Registered applications
Click on the New App button.
Name your application and click on Create.
You will get a client ID and client secret when the application is created.
Take note of the client secret
. You will not be able to see this secret again after closing the dialog box.
Add roles on the application details page to enable the application to access specific APIs.
It is best practice to give each application the minimal permissions it requires.
To obtain an access token, you will need to issue a POST request to the token endpoint:
https://login.microsoftonline.com/{{tenantId}}/oauth2/v2.0/token
The tenantId
and a summary of the required parameters is available on the Getting Started tab of the registered application page.
Request data:
grant_type: “client_credentials”
client_id: the client Id created by the registered application.
client_secret: the client secret you received when you created the registered application.
scope: <clientId>/.default
Example:
Response:
Note that the token expires after 1 hour, and you must generate it again.
C# Example:
The TokenData class
The base URL for Cubu’s S2S API is https://s2s.api.app.cubu.com/<applicationId>/
The application ID is available on the registered application’s General tab.
You must provide the access token as a Bearer token in the Authorization header of each API request.
The following request returns the specified customer record: