Microsoft is giving away 50,000 FREE Microsoft Certification exam vouchers!
Enter the sweepstakes now!Preparing for a certification exam? Ask exam experts all your questions on May 15th. Register now.
Hi,
I'm new to Power BI and I've been trying to connect data using API with Authentication in Get Data - WEB. I keep on getting "Token Prefix Missing" error.
I've tried all the steps I saw from the googel (use Basic, Advance - with/without Authorization in the header, add api key to username)
The API URL with the Bearer token works fine in Postman, so I'm really not sure why it is not connecting in Power BI.
Can someone help me please. 😢
Here is an example code I made for one API, the challenge I think is to understand what the API wants in the Headers and Body information.
This is first step to get the Token, then you will need to use the token in a second call to the API where you GET the data you want.
let
urlLogin="???",
//Body information with credential in this case
body = "{
""License"": ""??"",
""UserName"": ""??"",
""Password"": ""??"",
}",
//Create a JSON request to past to API
Parsed_JSON = Json.Document(body),
BuildQueryString = Uri.BuildQueryString(Parsed_JSON),
//Send and recive a replay inclusive the Access token.
GetTokenRecord = Json.Document(Web.Contents(urlLogin,[Headers = [#"Content-Type"="application/json",#"Accept"= "application/json"], Content = Text.ToBinary(BuildQueryString)])),
// Pick the token from the record, in this case the record was called Token in the table from the API.
token = GetTokenRecord[Token],
// Create the access token with Bearer in front if needed
access_token = "Bearer "&token,
in
access_token
Hi!
Do you know what type of API you try to connect to?
I never get the Get Data - Web to work, in my case it has been REST-API with credentials and token authorization. If its the same case for you, you will have to start with a Get Data - Blank Query and then write code were you pass your credentials and token to the API.
You also need the API documentation to be able to see how and where the token and credentials should be passed.
Hope it can help you on your path to find the solution.
Hi Karl,
Thank you for your reply!
The API I'm trying to connect is from Ceipal (this is an applicant tracking system used for recruiting). The API documentation can be downloaded for each report that I will need from the site. I'm not really sure how to know the type of their API but as per their API documentation I have the below details
API NAME :
Authentication Url :
Username :
Password :
Auth Key : {api_key:}
Format : {json:1} (0 for xml format)
Generate authtoken using this authentication and use this auth token to get the access for below API.
Authenticaiton type : bearer token
token : Token generated from authentication
Method : GET
Endpoint URL :
HI @chris05,
Perhaps you can take a look at the following blog about use web connector with optional parameters usages if it help for your scenario:
Using The RelativePath And Query Options With Web.Contents() In Power Bi
Regards,
Xiaoxin Sheng
Hi @Anonymous ,
I'll be checking this! Thank you!
Check out the April 2025 Power BI update to learn about new features.
Explore and share Fabric Notebooks to boost Power BI insights in the new community notebooks gallery.
User | Count |
---|---|
12 | |
4 | |
3 | |
2 | |
2 |
User | Count |
---|---|
14 | |
13 | |
7 | |
5 | |
4 |