Forum Discussion
sujeesh
6 years agoHelper I
How to iteratively pass a header parameter in to a API url to get the complete list from the API.
Hi, I have a below requirement to iteratively pass a header parameter in to a API url to get the complete list from the API. 1.Load the below API URL https://vsrm.dev.azure.com/fe-tfs/Advisory%20p...
- 6 years ago
It will look something like:
let NextResult = (token) => let URL = "https://vsrm.dev.azure.com/fe-tfs/Advisory%20products/_apis/release/releases?api-version=5.1", URLWithContinuation = if token = null then URL else URL & "&continuationToken=" & token, Content = VSTS.Contents(URLWithContinuation), AsJson = Json.Document(Content)[value], continuationToken = Value.Metadata(Content)[Headers][#"x-ms-continuationtoken"]?, Result = if continuationToken = null then AsJson else AsJson & @NextResult(continuationToken) in Result, AsTable = Table.FromRecords(NextResult(null)) in AsTable
artemus
6 years agoMicrosoft Employee
It will look something like:
let
NextResult = (token) =>
let
URL = "https://vsrm.dev.azure.com/fe-tfs/Advisory%20products/_apis/release/releases?api-version=5.1",
URLWithContinuation =
if token = null then
URL
else
URL & "&continuationToken=" & token,
Content = VSTS.Contents(URLWithContinuation),
AsJson = Json.Document(Content)[value],
continuationToken = Value.Metadata(Content)[Headers][#"x-ms-continuationtoken"]?,
Result =
if continuationToken = null then
AsJson
else
AsJson & @NextResult(continuationToken)
in
Result,
AsTable = Table.FromRecords(NextResult(null))
in
AsTable