Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Vote for your favorite vizzies from the Power BI Dataviz World Championship submissions. Vote now!

Reply
data_team_afri
Frequent Visitor

Error: Split json web contents with api token

Hello,
This is to request help to split a json weblink
I have an json file retreived from an api web link:


Before Change: 
= Json.Document(Web.Contents("
https://api.funnel.io/api/account/v1/-account_id-/project/project_id?group_by=campaign_day&start_day...")

 

After Change:

= Json.Document(Web.Contents(
"https://api.funnel.io/api/",
[
RelativePath="account/v1/-account_id-/project/project_id"
Query=
[

group_by="campaign_day",
start_day="2017-01-01",
end_day="2050-12-31",
fields="common-cost",
apiToken="12345_example",

]
]
))



Error message: token comma expected

I thought it could be an issue with the date formate. But I still get the same error after removing the two lines.

Reason for wanting change: 
to help power Bi service recognize the link for authentication

 

References:
1) http://blog.datainspirations.com/2018/02/17/dynamic-web-contents-and-power-bi-refresh-errors/

2) https://blog.crossjoin.co.uk/2016/08/16/using-the-relativepath-and-query-options-with-web-contents-i...

3 REPLIES 3
data_team_afri
Frequent Visitor

Here are the corrected web contents which work on the power BI desktop. (there was a comma missing after the relative path.
Refresh successful in desktop but fails to authenticate on the power BI service.


Failed to update data source credentials: Web.Contents failed to get contents from 'https://api.funnel.io/api/' (404): Not Found

 

= Json.Document(Web.Contents("https://api.funnel.io/api/",
[
RelativePath="account/v1/-account_id-/project/project_id",
Query=
[
group_by="campaign_day",
start_day=Date.FromText("2017-01-01"),
end_day=Date.FromText("2050-12-31"),
fields="common-cost",
apikey="12345_example",
]
]
))

 

Hi data_team_afri,

 

The site url may not the domain or the root path of the server which can be visited. You may change the domain url and try again.

 

Regards,

Jimmy Tao

v-yuta-msft
Community Support
Community Support

Hi data_team_afri,

 

Maybe you can mofidy the query like this and check if this can work.

= Json.Document(Web.Contents("https://api.funnel.io/api/",
[
RelativePath="account/v1/-account_id-/project/project_id"
Query=
[
group_by="campaign_day",
start_day=Date.FromText("2017-01-01"),
end_day=Date.FromText("2050-12-31"),
fields="common-cost",
apikey="12345_example",
]
]
))

Regards,

Jimmy Tao

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

Vote for your favorite vizzies from the Power BI World Championship submissions!

Sticker Challenge 2026 Carousel

Join our Community Sticker Challenge 2026

If you love stickers, then you will definitely want to check out our Community Sticker Challenge!

January Power BI Update Carousel

Power BI Monthly Update - January 2026

Check out the January 2026 Power BI update to learn about new features.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.