Forum Discussion
MyThumbsClick
Helper II
2 years agoAPI auth - Use parameter instead of Data Source Setting GUI
Hi All Very new to Power BI but slowly figuring things out. I have a json API source that currently uses a web source and Basic authentication via the Data Source GUI. This works great. Usernam...
- 2 years ago
change your data source settings to anonymous auth.
MyThumbsClick
Helper II
2 years agoThanks for your help. I went back to the API documentation and found this article detailing how to connect via powershell.
Running that powershell script with the Base64 key works (and i can get data from the API).
$credPair = "<your-freshservice-api-token>:.";
$encodedCredentials = [System.Convert]::ToBase64String([System.Text.Encoding]::ASCII.GetBytes($credPair));
$headers = @{ Authorization = "Basic $encodedCredentials" };
$url = "https://<your-subdomain>.freshservice.com/api/v2/tickets/1?include=assets";
$Response = Invoke-WebRequest -Uri $url -Method Get -Headers $headers -UseBasicParsing;
$Response.Content;
The format for the headers line matches what you suggested and what i have in my query but i get the following error:
lbendlin
Super User
2 years agoShow the definition of FreshServiceBaseURL
- MyThumbsClick2 years ago
Helper II
I have tested omitting the variable, instead inserting the API straight into the query like below but no dice.
Headers=[Authorization="Basic <Base64encoded APIKEY>)"]The value of the Parameter is:
Basic <Base64encoded API Key>- lbendlin2 years ago
Super User
is that extra parenthesis a typo?
- MyThumbsClick2 years ago
Helper II
are you reffering to the <> charecters? They were for illistrutive purposes and not actually in use - sorry for conufusion