Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

Reply
avictoria
Frequent Visitor

Advanced Editor - API bearer

Experts,

 

Power BI data is getting from api link. I have difficulty to connect using token authenticaton . Following is my code. What i am doing wrong here. please advise. 

 

let

test = {username : Lordloc , password : ******},

AccessTokenHeader = "test" & "Bearer *" ,

Headers = [Authorization = AccessTokenHeader],

url = "https://dfsf.cdsfe.ae:3289/dede/getCusfedfsfock",


body = "{ ""plant"" : ""c051"",
""storageLocation"" : ""0001"",
""type"" : ""MARD"",
""sapid"": ""qEP""
}",


Source = Json.Document(Web.Contents(url,[
Headers = [#"Content-Type"="application/json"],
Content=Text.ToBinary(body)
])),
#"Converted to Table" = Table.FromList(Source, Splitter.SplitByNothing(), null, null, ExtraValues.Error),
#"Expanded Column1" = Table.ExpandRecordColumn(#"Converted to Table", "Column1", {"plant", "material", "storageLocation", "warehouseNo", "quant", "storageType", "unrestrictedStock", "stockInTfr", "qualityInsp", "restrictedUse", "blocked", "returns", "totalQuantity", "availableStock"}, {"Column1.plant", "Column1.material", "Column1.storageLocation", "Column1.warehouseNo", "Column1.quant", "Column1.storageType", "Column1.unrestrictedStock", "Column1.stockInTfr", "Column1.qualityInsp", "Column1.restrictedUse", "Column1.blocked", "Column1.returns", "Column1.totalQuantity", "Column1.availableStock"}),
#"Renamed Columns" = Table.RenameColumns(#"Expanded Column1",{{"Column1.material", "material"}, {"Column1.plant", "plant"}, {"Column1.unrestrictedStock", "unrestrictedStock"}})
in
#"Renamed Columns"

 

 

teste

2 REPLIES 2
v-stephen-msft
Community Support
Community Support

Hi @avictoria ,

 

Does any error message appear? I can't reproduce your error scenario here.

For now, you may check the following link for reference.

Solved: How to configure Power BI REST API as a data sourc... - Microsoft Power BI Community

 

 

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.

 

avictoria
Frequent Visitor

Friends your input is much appreciated. 

Helpful resources

Announcements
PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

Top Solution Authors
Top Kudoed Authors