Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.
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.
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.
User | Count |
---|---|
107 | |
98 | |
78 | |
65 | |
53 |
User | Count |
---|---|
144 | |
103 | |
98 | |
85 | |
64 |