Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.
Register now!The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more
Hi !
I need to take data with several parameters present in the API response.
I write this code but he didn't work :
let
BaseUrl = "https://ecofac.nicoka.com/api/jobs/&hr__=1&limit=1000",
Token = "token",
EntitiesPerPage = 100,
GetJson = (Url) =>
let Options = [Headers=[ #"Authorization" = "Bearer " & Token ]],
RawData = Web.Contents(Url, [Headers=[Authorization="Bearer token"]]),
Json = Json.Document(RawData)
in Json,
GetTotalEntities = () =>
let Json = GetJson(BaseUrl),
Total = Json[total]
in Total,
GetUid = () =>
let Json = GetJson(BaseUrl),
Uid = Json[queryUid]
in Uid,
GetPage = (Index) =>
let Skip = "queryUid=" & Text.From(Uid) & "&" & "queryPage=" & Text.From(Index),
Url = BaseUrl & "&" & Skip,
Json = GetJson(Url),
Value = Json[data]
in Value,
GetUrl = (Index) =>
let Skip = "queryUid=" & Text.From(Uid) & "&" & "queryPage=" & Text.From(Index),
Url = BaseUrl & "&" & Skip
in Url,
EntityCount = List.Max({ EntitiesPerPage, GetTotalEntities() }),
PageCount = Number.RoundUp(EntityCount / EntitiesPerPage),
PageIndices = { 0 .. PageCount + 1 },
Uid = GetUid(),
URLs = List.Transform(PageIndices, each GetUrl(_)),
Pages = List.Transform(PageIndices, each GetPage(_)),
Entities = List.Union(Pages)
in
Entities
He return me that : "we were unable to authenticate with the information provided. Try again"
But when i just take data with simple code it's work like that code :
let
Source = Json.Document(Web.Contents("https://ecofac.nicoka.com/api/jobs/&hr__=1&limit=1000", [Headers=[Authorization="Bearer token"]]))
in
Source
I need your's helps
Thanks you for read and tried to help me 🙂
Solved! Go to Solution.
This part of the code is incorrect
GetJson = (Url) =>
let Options = [Headers=[ #"Authorization" = "Bearer " & Token ]],
RawData = Web.Contents(Url, [Headers=[Authorization="Bearer token"]]),
Json = Json.Document(RawData)
in Json,
Should be
GetJson = (Url) =>
let Options = [Headers=[ #"Authorization" = "Bearer " & Token ]],
RawData = Web.Contents(Url, Options),
Json = Json.Document(RawData)
in Json,
Hi !
Thanks it work perfectly now !
See you soon 😉
This part of the code is incorrect
GetJson = (Url) =>
let Options = [Headers=[ #"Authorization" = "Bearer " & Token ]],
RawData = Web.Contents(Url, [Headers=[Authorization="Bearer token"]]),
Json = Json.Document(RawData)
in Json,
Should be
GetJson = (Url) =>
let Options = [Headers=[ #"Authorization" = "Bearer " & Token ]],
RawData = Web.Contents(Url, Options),
Json = Json.Document(RawData)
in Json,
The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!
| User | Count |
|---|---|
| 19 | |
| 10 | |
| 9 | |
| 7 | |
| 6 |