Forum Discussion
Dynamic DataSource Error - RelativePath and Query?
- 2 years ago
Hi leemat
As an example of creating a Web data connection using URL and Relative Path, you can see an example in the below that I use to extract Strava data:
let RelativePath = "/" & AthleteID & "/stats", Payload = [RelativePath = RelativePath, Headers=[Authorization = "InsertTokenHere"]], Source = Web.Contents("https://www.strava.com/api/v3/athletes", Payload), JSON = Json.Document(Source) in JSON
_____________________________________________________
I hope my comment was helpful.
If your question was answered, please mark your post as 'Solved' and consider giving me a 'Thumbs Up'.
Find me on LinkedIn, Sessionize, or my blog Downhill Data
Hi leemat ,
Try using this base url:
oauthSite = "https://<Redacted>.docebosaas.com",
oauthEndpoint = "/oauth2/token",
Like:
let
oauthSite = "https://<Redacted>.docebosaas.com",
oauthEndpoint = "/oauth2/token",
clientId = "<Redacted>",
clientSecret = "<Redacted>",
email = "<Redacted>",
pwd = "<Redacted>",
tokenURL = "client_id=" & clientId & "&" & "client_secret=" & clientSecret & "&" & "grant_type=password&scope=api&username=" & email & "&" & "password=" & pwd,
binaryTokenURL = Text.ToBinary(tokenURL),
tokenData = Json.Document(Web.Contents(oauthSite & oauthEndpoint, [Headers = [#"Content-Type"="application/x-www-form-urlencoded"], Content=binaryTokenURL])),
token = tokenData[access_token],
ver = "/analytics/v1/",
page = "reports/",
idReport = "2b5d6a72-0a66-43ef-9b68-70742e03e569/",
csv = "export/csv",
endPoint = oauthSite & ver & page & idReport & csv,
Source = Json.Document(Web.Contents(endPoint, [Headers=[Authorization="Bearer " & token, Accept="application/json"]])),
data = Source[data],
executionId = data[executionId],
endpoint2 = oauthSite & ver & page & idReport & "exports/" & executionId & "/results" & "?pageSize=1000",
...
...
...
in
DataSet
Best Regards,
Gao
Community Support Team
If there is any post helps, then please consider Accept it as the solution to help the other members find it more quickly.
If I misunderstand your needs or you still have problems on it, please feel free to let us know. Thanks a lot!
How to get your questions answered quickly -- How to provide sample data in the Power BI Forum -- China Power BI User Group