Data API with token and Excel

I have been able to integrate a Data API as data source in an Excel file. The data source in Excel updates well with the data from my Bubble app, but this only works when I let “Everyone” see all the data (in Privacy settings). In this case no token is needed to use the API, all is public.

Now, with Privacy rules on the data, I have to use an API token. The token should give full access to the data. But so far I have been unable to properly configure the token in Excel. Here is my setting:

My API Token Label is set to “token” in Bubble settings

My data source in Excel has following configuration:
URL: “https://mydomain.com/version-test/api/1.1/obj/project”, with mydomain.com replaced with my Bubble app domain.
Open file as JSON file

I have edited the data source (Power Query) to add a reference to an API token name:
= Json.Document(Web.Contents(“https://XXXX.com/version-test/api/1.1/obj/project”, [ApiKeyName=“token”]))
I have configured the authorizations of the Excel data source to “Web API” and entered the API token here:
image

With this configuration all I get in Excel is an empty set with:
cursor 0, results [List], remaining 0, count 0, and with [List] empty
This is the response that the API give for unauthenticated users.
If I remove the privacy rules, then I get back all my data into excel. There’s something wrong in the token configuration/use but I can’t figure that out.
Any thoughts? Thanks!

If you add the token in the url like this does it work?
https://mydomain.com/version-test/api/1.1/obj/project?token=token_goes_here

1 Like

Thanks, I tried this too in the Excel file as well as in a browser window (incognito mode) and neither works. They both give me empty sets. The browser response is so:
{
“response”: {
“cursor”: 0,
“results”: [],
“remaining”: 0,
“count”: 0
}
}

I also tried to add the token to the header request in the browser with the ModHeader addon in Chrome with no success.

I didn’t check but the correct parameter is api_token and not just token=

That works. I should have better read the “authentication” section of API in Bubble manual.
Thanks!

@Jici I have a project for which I am looking for several solutions. I think we can help each other I want to contact you…by which means do you prefer?

You can send me a PM here :wink:

I just tried the message says unable to send to this user!