Forum Discussion
Unleashed inventory system and Power Query
- 4 years ago
You'll have to write your own headers in your Power Query function to send the api-auth-id, api-auth-signature, and other headers requested by the Unleashed API. Authenticate as "anonymous" in Power BI and handle all the authentication requirements in your M code. You're in luck that Unleash is simple as they don't require Oauth tokens.
There's no "standard methology" because every API is different. It's very rare that you'll find M documentation from an API provider, usually you'll have cURL, JavaScript, Python, PHP... the usual suspects. Best place to start is from the vendor sandbox as you did, or use Postman if there's no sandbox.
Chris Webb has good content on his blog about making API calls from Power BI. It's not for the faint of heart, but it can be done. Not the easiest thing to do if you've never used Power Query before as you're likely to go from on roadblock to the next, that said it would be a great learning experience if you have the time and inclination.
I've tried to isolate this error by taking out that Json bit, and breaking my code into smaller blocks where I ideally understand what's going on. The web.contents documentation has helped advance my understanding.
However, I seem to be pulling the webpage as HTML, not actually taking data out of the API, and I don't really understand why/how to change this. Results:
From my simplified query:
I think this is just because I have written the query in Web.Contents wrong. When I actually save the code, it keeps making some auto changes based on the fact it recognises the incoming data as HTML.
You're getting HTML in return because you're calling the root of the api subdomain. You need to call an actual endpoint, for instance https://api.unleashedsoftware.com/ProductPrices for:
https://apidocs.unleashedsoftware.com/ProductPrices
Read the Getting Started section of https://apidocs.unleashedsoftware.com/