Get certified for free when you join Fabric Data Days 2026 and dive into Fabric, Power BI, SQL, AI, and other essential data skills.
Join nowJuly 7 - July 17 | Round 2 of the Power BI Dataviz World Championships. Don't miss your chance! Learn more
I have the following query that generates a token to be used for an API call, but I'm getting an error message stating: Undefined Variable: json
I'm not sure if I'm missing anything or doing anything wrong?
let
api_url = "https://someapi.com/api/",
token_path = "getAccessToken",
Token_Response = Json.Document(Web.Contents(api_url,
[
RelativePath = token_path,
Headers = [#"Content-Type"="application/x-www-form-urlencoded"],
Content=Text.ToBinary("username=clientid&password=password111")
]
)
),
token = Token_Response[token],
path = "getList",
endDate = "2022-04-25 00:00:00",
startDate= "2022-04-26 00:00:00",
data1= Json.Document(Web.Contents(api_url,
[
Headers = [#"Accept"="application/json"],
RelativePath = path,
Query = [end_date=endDate, start_date=startDate, api_token=token]
]
)
)
in
data1
Hi @PowerUser123 ,
Please make sure the token or data1 reponse of web.connect is json type.
Best Regards
Community Support Team _ chenwu zhu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Join us in Barcelona for FabCon and SQLCon, the Fabric, Power BI, SQL, and AI community event. Save €200 with code FABCMTY200.
Join Data Days 2026: 60 days of free live/on-demand sessions, challenges, study groups, and certification opportunities.
| User | Count |
|---|---|
| 29 | |
| 28 | |
| 26 | |
| 26 | |
| 19 |
| User | Count |
|---|---|
| 54 | |
| 48 | |
| 39 | |
| 28 | |
| 21 |