Forum Discussion
API authentication error on scheduled refresh!
- 7 years ago
Try this, substituting in your api key, and see if you see the same error
let
vBaseUrl = "https://api.projectmanager.com",
vPath = "api/v1/projects.json",
vHeaders = [ #"apikey"="this is where i put my key" ],
Source = Web.Contents ( vBaseUrl, [RelativePath=vPath, Headers=vHeaders] ),
Json = Json.Document ( Source )
in
Json
Hi blopez11
thanks for the speedy response!
This is the M code:
let
Source = Json.Document(Web.Contents("https://api.projectmanager.com/api/v1/projects.json", [Headers=[apikey="this is where i put my key"]]))
in
Source
Try this, substituting in your api key, and see if you see the same error
let
vBaseUrl = "https://api.projectmanager.com",
vPath = "api/v1/projects.json",
vHeaders = [ #"apikey"="this is where i put my key" ],
Source = Web.Contents ( vBaseUrl, [RelativePath=vPath, Headers=vHeaders] ),
Json = Json.Document ( Source )
in
Json
- rdubs7 years agoFrequent Visitor
It worked at first blopez11 and let me put details into the 'basic' authentication section, but when the scheduled refresh came through it showed me this:
Is there a way of just including the api key into the URL itself?
- blopez117 years agoSuper User
Try using anonymous authentication, I thought that was the method you were using from the initial comment.
If you need basic autentication, then that requires a username and password
For basic, sometimes I see vendors have some kind of combo value for the password (i.e. api user password + key)
I guess I am not sure of the authentication your API requires
- Anonymous6 years agoNot applicable
blopez11 thanks a lot.
- opsus6 years agoRegular Visitor
I tried this exactly same approach and my datasets seems to be working correctly as webapis, but I still get the credential warnings on the powerbi service when I try to connect the gateway even using anonymous authentication.
Any suggestions?
- antik6 years agoFrequent Visitor
Did you try using the "Skip test connection" option? Using this option is nicely explained in this blog post: https://blog.crossjoin.co.uk/2019/04/25/skip-test-connection-power-bi-refresh-failures/
- amirshiloh4 years agoAdvocate II
the relative path setting is critical and solve issues with API when have cradentials indicate a failure on refresh.
see also Using The RelativePath And Query Options With Web.Contents() In Power Query And Power BI M Code