Forum Discussion
Anonymous
2 years agoNot applicable
dynamic API call depending on selected project
I would like to call an API dynamically depending on which project is called (via slicer). Via a parameter I can control the M-code so that the API is called correctly. However, I would like the para...
Anonymous
2 years agoNot applicable
Hi Anonymous - to make the query dynamic using a M parameter you need to use a Relative Path reference to call the API. Please see the example in the Power Query documentation. Web.Contents - PowerQuery M | Microsoft Learn. So, instead of creating a single string with the full URL path, you need to break into BaseUrl, the relativepath and query. Something like this:
BaseUrl = "https://xxxxxx/api",
RelativePath = "xxxx" & Parameter,
Query = "xxxx"