Board API query: How to authenticate and use Secrect Key
Can anyone show me an example of calling the board api queries? I have am API user setup with a secrect key, and a query.
example. curl -X GET "http://p-p-board4/public/ARGDB/query/indexPricesNymex"
Answers
-
This Is what I get when pasting into CMD. {"message":"Authorization has been denied for this request."}
0 -
Hi @Mike Spagnolo,
if you are using Board public API on a recent version (Spring '22 onward) make sure you properly configured the authorization:
- Grant Type: Client Credentials
- Scope: public-api
- Client Authentication: Send client credentials in body
- Client Id: boardapiclient
- Client secret: *************
- auth URL: https://your-subscription-hub-url/identity/connect/token
- Access token URL: https://your-subscription-hub-url/identity/connect/token
0 -
Are you able to provide a full example of the process and API call? I assume its something like this.
- Authenticate
POST to https://your-subscription-hub-url/connect/authorize
(please show what the body object and headers should be)
2. Get Access Token
POST to URL: https://your-subscription-hub-url/connect/token
(please show what the body object and headers should be)
3. Get the Data from Endpoint
GET to URL: https://your-subscription-hub-url/endpoint/<token>
(please show what the URI should look like for adding the token)
0 -
Hi Mike,
here are the CURL command, hopefully they can help you.
POST Request to get the Access Token
curl --data "grant_type=client_credentials&scope=public-api&client_id=<your_API_client_user>&client_secret=<your_API_client_password>" http://p-p-board4/identity/connect/token
GET Request to get API Query data
curl -H "Authorization: Bearer <access_token>" http://p-p-board4/public/ARGDB/query/indexPricesNymex
As for the API Client user, please refer to this page
Andrea
0 -
I am unable to get the token. When I run
POST curl --data "grant_type=client_credentials&scope=public-api&client_id=<your_API_client_user>&client_secret=<your_API_client_password>" http://p-p-board4/identity/connect/token
I get an error {"error":"unauthorized_client"}. I have setup the api user in board with the name "boardpublicapiclient" and the secret key that was referenced in the documentation.
0 -
Hi Mike,
I suggest you to open a case on our support portal support.board.com so we can take a look at this in detail and keep track of the analysis.
Thanks!
Andrea
0 -
Hi @Andrea Duò
According to a recent discussion with the support team, it looks like the is a mistake on the following
curl --data "grant_type=client_credentials&scope=public-api&client_id=<your_API_client_user>&client_secret=<your_API_client_password>" http://p-p-board4/identity/connect/token
/identity is not needed
thanks
0 -
Hi Nicolas,
You are right the "identity" in the Access Token url is not required since your Board environment is on cloud and has a subscription hub.
Just pointing out the parameters required to obtain the authorization token for two different installations/scenarios here:
When the Board environment is in the cloud and has a subscription hub (idp)
- Grant Type: "Client Credentials"
- Access Token URL: https://your-subscription-hub-url/connect/token
- Client ID: boardpublicapiclient
- Client Secret: ************
- Scope: "public-api"
- Client Authentication: "Send client credentials in body"
When the Board environment is on-premises or is on cloud without a subscription hub (idp)
- Grant Type: "Client Credentials"
- Access Token URL: https://your-platform-url/identity/connect/token
- Client ID: boardpublicapiclient
- Client Secret: ************
- Scope: "public-api"
- Client Authentication: "Send client credentials in body"
Thanks,
Samson.2 -
Thanks @Samson Sunny!
@Nicolas BENDONGUE, the same explanation of the difference between Board on-premise and cloud for the token URL can be found on this page
Andrea
2
Categories
- All Categories
- 1.8K Forums
- 1.7K Platform
- 105 Academy
- 280 Resources
- 3 Community Captains
- 1 About Community Captains
- 1 Meet the Community Captains
- 1 Topics & Thought Starters
- Board Manual
- 50 Best Practices
- 41 How-To Guides
- 25 Board Advocacy Program
- 157 Blog
- 4 Groups Hub
- 4 About Groups
- New Community Members
- DACH
- Japan
- Academy
- 2 Board Academy
- 7 ILT/VILT Course Catalogue
- 13 e-Learning Course Catalogue
- 4 Academy Forum
- 1.1K Idea Exchange
- 305 Partner Hub
- 2 Solution Sales Toolkits
- 91 Support
- 14 FAQ's
- Customer Support Portal
- 54 Support Articles
- BEAP