Forum Discussion
Access data from POST API
- Anonymous5 years ago
HI Anonymous,
>>DataSource.Error: The downloaded data is HTML, which isn't the expected type. The URL may be wrong or you might not have provided the right credentials to the server.
Perhaps this issue appears when you try to use the wrong connector to recognize response data.
I'd like to suggest you navigation to the 'Source' step to confirm the result type and change to the corresponding connector in the next steps to recognize/analytics records.Regards,
Xiaoxin Sheng
Your request is incomplete. POST requires a payload in the request body.
Hi lbendlin,
Thanks for the reply.
Yes I have another link as well as Payload contains the username and password to access the data from the given link
Thanks
- lbendlin5 years agoSuper User
Here is an example. Use Json.FromValue to binary encode your payload
let
URL = "http://xxx/tstat",
headers = [#"Content-Type"="application/json"],
data = Json.FromValue([tmode = 2,t_cool = Setpoint,hold = 0]),
web = Web.Contents(URL, [ Content = data, Headers = headers, ManualStatusHandling = {404, 400}]),
result = Json.Document(web)in
result
- Anonymous5 years agoNot applicable
- lbendlin5 years agoSuper User
This is Power Query (also referred to as M) . You use that to connect to your data sources.
If you are new to Power BI then you may want to start with an easier project. Running POST calls is rather advanced.