Forum Discussion
Dataflows - Web API - authentication
- 5 years ago
If you have it working through Desktop, you can create a Dataflow from Blank Query and copy/paste your M code from the Advanced Editor in Desktop. Have you tried that?
Pat
I believe that Daz4 was asking how to add headers to an http GET via Web.Contents.
See code snippet below which shows how to encode user/password for Basic authentication. Also demonstrates how to include multiple Headers in a Web.Contents call.
let
Username = "[your username]",
Password = "[your password or TOKEN]",
UserPass = Username & ":" & Password,
Bytes = Text.ToBinary(UserPass),
Base64_UserPass = Binary.ToText(Bytes, BinaryEncoding.Base64),
TargetURL = "[target URL]",
//TargetURL = "https://companyxyz.atlassian.net/rest/api/latest/search",
Source = Json.Document(Web.Contents(TargetURL,
[
Headers = [
#"Authorization" = "Basic " & Base64_UserPass,
#"Content-Type" = "application/json"
]
]
))
in
Source
Once you have verified that your included Headers work... THEN you can follow mahoneypat suggestions of copying M Query from Desktop Power BI. Again, the problem stated was related to including Headers in a Web.Contents call, as PowerApps DataFlow to Dataverse connection properties do not allow Basic (or other) Authentication methods besides Anonymous and Organization.
Note... this works great with JIRA extraction... see commented example inline.