Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more. Get started
Hi,
While using the below code to to get the api content iteratively, i am getting the authentication error. Can some one help me to resolve this issue
let
// Define the base URL of the Work Item Link REST API
baseUrl = "https://dev.azure.com/@@@@/@@@@/_apis/wit/workItemLinks",
// Define the request options for the Work Item Link REST API
requestOptions = [
Headers = [
#"Content-Type" = "application/json",
#"Authorization" = "Bearer *******************************"
],
Query = [
#"api-version" = "6.1-preview.3",
#"sourceIds" = "123",
#"$top" = "100"
]
],
// Define a recursive function to retrieve all the work item links using the continuationToken
getWorkItemLinksRecursive = (requestOptions as record, links as list) =>
let
// Call the Work Item Link REST API with the specified requestOptions and retrieve the links
response = Json.Document(Web.Contents(baseUrl, requestOptions)),
newLinks = links & response[value],
continuationToken = response[#"continuationToken"]
in
// If there is a continuationToken, call the function again with the updated requestOptions and links
if continuationToken <> null then
let
newRequestOptions = requestOptions & [Query = requestOptions[Query] & [#"continuationToken" = continuationToken]],
newLinks = getWorkItemLinksRecursive(newRequestOptions, newLinks)
in
newLinks
// If there is no continuationToken, return the final list of links
else
newLinks,
// Call the recursive function to retrieve all the work item links
allLinks = getWorkItemLinksRecursive(requestOptions, {})
in
// Transform the links data as needed
allLinks
I'd suggest trying: Json.Document(VSTS.Contents(baseUrl, requestOptions)) instead of Json.Document(Web.Contents(baseUrl, requestOptions)) for API calls (your response step). I typically have more success with that when using the API instead of oData.
You might have to rewrite some of the subsequent steps accordingly also.
I wrote this article https://www.linkedin.com/pulse/retrieve-long-text-fields-from-azure-devops-powerbi-van-der-vorst/?tr... previously on LinkedIn, where I used an API. It might get you on your way also.
Check out the September 2024 Power BI update to learn about new features.
Learn from experts, get hands-on experience, and win awesome prizes.
User | Count |
---|---|
116 | |
101 | |
87 | |
35 | |
35 |
User | Count |
---|---|
152 | |
100 | |
83 | |
63 | |
54 |