Forum Discussion
Json.Document Web.Content Swagger API
- 6 years ago
Hi
try this:
Source = Json.Document(Web.Contents("http://193.160.3.15:60003/api/Product?vpArticleNumbers=" & Text.From(vpArticleNumbers), [Headers=[Token="MYTOKEN"]])),In the syntax higlighting you will see that the first "vpArticleNumbers" will be considered as text, while the second (without quotes) will be regarded as the parameter from your function. It has to be converted as text for the Web.Contents-function.
But please be aware that this query will not refresh in the services as it is. Therefore you have to use the relative path parameter: http://blog.datainspirations.com/2018/02/17/dynamic-web-contents-and-power-bi-refresh-errors/
let
Source = (vpArticleNumbers as number) as table => let
Source = Json.Document(Web.Contents("http://193.160.3.15:60003/api/Product?",vpArticleNumbers, [Headers=[Token="MYTOKEN"]])),
Source1 = Source{0},
#"Converted to Table" = Record.ToTable(Source1),If i do this i get this error
Hi
try this:
Source = Json.Document(Web.Contents("http://193.160.3.15:60003/api/Product?vpArticleNumbers=" & Text.From(vpArticleNumbers), [Headers=[Token="MYTOKEN"]])),
In the syntax higlighting you will see that the first "vpArticleNumbers" will be considered as text, while the second (without quotes) will be regarded as the parameter from your function. It has to be converted as text for the Web.Contents-function.
But please be aware that this query will not refresh in the services as it is. Therefore you have to use the relative path parameter: http://blog.datainspirations.com/2018/02/17/dynamic-web-contents-and-power-bi-refresh-errors/
- patoduck6 years agoHelper III
Thanks ImkeF !
😍
let Source = (vpArticleNumbers as number) as table => let Source = Json.Document(Web.Contents("http://193.160.3.15:60003/api/Product?vpArticleNumbers="& Text.From(YOURNUMBER), [Headers=[Token="YOUR TOKEN"]])), Source1 = Source{0}, #"Converted to Table" = Record.ToTable(Source1), #"Transposed Table" = Table.Transpose(#"Converted to Table"), #"Promoted Headers" = Table.PromoteHeaders(#"Transposed Table", [PromoteAllScalars=true]) in #"Promoted Headers"