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
I'm trying to make an API I set up more dynamic so that I don't requery the same data everytime it refreshes.
I've set up the parameters and am able to pass the second parameter successfully, but when I try to set the 1st parameter in the middle of the URL, I get error "(422) unprocessable entity". The two parameters I am trying to pass are start date & end date. Both need to be in UNIX format, which is what I have as the default values.
For now, I've hard coded the 2nd parameter just to see if I can get the 1st parameter (StartDateUNIX) to pass successfully.
Can anyone suggest what I'm doing wrong?
let
Source = Json.Document(Web.Contents("https://api.baseurl.com/api/word/word/word/range?vs_currency=usd&from="&StartDateUNIX&"to=&1663288582")),
#"Converted to Table" = Record.ToTable(Source),
#"Expanded Value" = Table.ExpandListColumn(#"Converted to Table", "Value"),
I'm using this walkthrough as a reference.
https://wisedatadecisions.com/2021/05/03/parameterize-an-api-request-in-power-query/
Solved! Go to Solution.
Hi @bigshooTer
Please refer to 422 Unprocessable Entity Explained - KeyCDN Support,
The 422 (Unprocessable Entity) status code means the server understands the content type of the request entity (hence a 415 (Unsupported Media Type) status code is inappropriate), and the syntax of the request entity is correct (thus a 400 (Bad Request) status code is inappropriate) but was unable to process the contained instructions.
Based on above explanation, I think your M code is correct. You may need to check the current value for parameter StartDateUNIX. Hard code two parameter values to test whether it returns the same 422 error when using the same start date and end date values. I guess probably the API sets a valid value range for these date parameters. If the value passed to the first parameter is out of the valid range, it may return this error.
Best Regards,
Community Support Team _ Jing
If this post helps, please Accept it as Solution to help other members find it. Highly appreciate your Kudos!
Hi @bigshooTer
Please refer to 422 Unprocessable Entity Explained - KeyCDN Support,
The 422 (Unprocessable Entity) status code means the server understands the content type of the request entity (hence a 415 (Unsupported Media Type) status code is inappropriate), and the syntax of the request entity is correct (thus a 400 (Bad Request) status code is inappropriate) but was unable to process the contained instructions.
Based on above explanation, I think your M code is correct. You may need to check the current value for parameter StartDateUNIX. Hard code two parameter values to test whether it returns the same 422 error when using the same start date and end date values. I guess probably the API sets a valid value range for these date parameters. If the value passed to the first parameter is out of the valid range, it may return this error.
Best Regards,
Community Support Team _ Jing
If this post helps, please Accept it as Solution to help other members find it. Highly appreciate your Kudos!
The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!
| User | Count |
|---|---|
| 19 | |
| 10 | |
| 9 | |
| 8 | |
| 7 |