Forum Discussion
API Data not refreshing because of token
I have a power bi Report built using a call to a local API
First thing I did was to invoke the authorisation token which after a while i got working. I am then using the gettoken function in 3 sub functions
response = Json.Document(Web.Contents("???/system/api/v1/auth/token",[Content=Json.FromValue(data),Headers=header])),
This is one of the queries
Source = Json.Document(Web.Contents("??/intent/api/v1/topology/l2/"&Vlan, [Headers=[#"x-auth-token"=GetToken()]]))
I understand why power bi does not like this because it needs to call this function
I read i can try spitting up the URL using query but this has proved unsucessful
I changed this
Source = Json.Document(Web.Contents("??/intent/api/v1/topology/l2/"&Vlan, [Headers=[#"x-auth-token"=GetToken()]]))
to
Source = Json.Document(Web.Contents("???/intent/api/v1/topology/",
[RelativePath="l2/",
Query=[Vlan=Vlan,
Headers=[#"x-auth-token"=GetToken()]]]))
Any help would be really appreciated
Thanks
1 Reply
- AnonymousNot applicable
Hi KieranQuinn1 ,
Here are a few suggestions you can try:
Check token expiration: Make sure the token you’re using hasn’t expired. If it has, you’ll need to refresh it before making API requests.
Verify token usage: Ensure that you’re correctly passing the token in the headers of your API requests. Double-check the syntax and make sure it matches the expected format.
Best Regards,
Stephen Tao
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.