Using PowerBI API key for in Excel Power Query

Hi there,

I am attempting to use the API key provided by Agworld, a farm management software which reocrds budgets and actuals for farms, in Excel’s Power Query. I am using the “Get Data” “From Web” option. There is something wrong with the way I am keying in the details, as I am getting the error that my credential cant be verified.
ON the API documentation page, the following has been mentioned:

The token must be supplied along with each request in one of two ways:

  1. As a request parameter e.g.
 curl <url>/user_api/v1/fields?api_token=token \
 -H 'Content-Type: application/vnd.api+json' \
 -H 'Accept: application/vnd.api+json'
  1. As a header parameter e.g.
 curl <url>/user_api/v1/fields \
 -H 'Content-Type: application/vnd.api+json' \
 -H 'Accept: application/vnd.api+json' \
 -H 'Api-Token: token'

I have tried different combinations to key in the web page and api details, but to no avail. Your help will be appreciated

Hi @musa.fasih ,

To integrate the Agworld API with Excel’s Power Query, use the following approach:

Open Excel and navigate to the Data tab.
Select “Get Data” > “From Other Sources” > “From Web.”
In the “From Web” dialog box, choose “Advanced.”
Enter the URL and API token as shown:
URL parts:

https://my.agworld.com.au/user_api/v1/fields
Query string parameters:
api_token=your_api_token_here
Add HTTP request headers:
Content-Type: application/vnd.api+json
Accept: application/vnd.api+json
Click “OK” to load the data.

For more detailed assistance, run your query at the Data Mentor site.

Cheers,

Enterprise DNA Support Team

Hi @musa.fasih ,

It seems you are facing issues with the way you’re inputting the API details into Excel’s Power Query. Based on the documentation, you can pass the API token either as a request parameter or as a header parameter.

Here’s how you can set it up in Excel Power Query:

  1. URL with Request Parameter:
  • Use the URL parts field to enter the API endpoint with the token as a query parameter, like:
  1. Header Parameter:
  • Add headers in the HTTP request header parameters (optional) section:
    • Content-Type: application/vnd.api+json
    • Accept: application/vnd.api+json
    • Api-Token: YOUR_TOKEN

Double-check to ensure your API token is correctly inserted and not expired. This setup should align with the API documentation requirements. If you still encounter issues, consider checking the API documentation for any additional headers or parameters required.

For more detailed queries or advanced troubleshooting, consider seeking help from the Data Mentor platform here.

bashCopy codehttps://my.agworld.com.au/user_api/v1/fields?api_token=YOUR_TOKEN

Cheers,

Enterprise DNA Support Team

Sorry I am still not able to get it right…

I get the following error message:

“We couldnt authenticate with credentials provided, please try again”

I then go to the Web API and enter API key, even then it does not work. The message that I get then is " A web API key can only be specified when a Web API name is provided"

Hi there,

I’m wondering if you clear on all your cache and create a new one.

thanks
Keith