Don't miss your chance to take the Fabric Data Engineer (DP-600) exam for FREE! Find out how by attending the DP-600 session on April 23rd (pacific time), live or on-demand.
Learn moreNext up in the FabCon + SQLCon recap series: The roadmap for Microsoft SQL and Maximizing Developer experiences in Fabric. All sessions are available on-demand after the live show. Register now
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!
If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.
A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.
Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.
| User | Count |
|---|---|
| 5 | |
| 3 | |
| 3 | |
| 3 | |
| 2 |