Forum Discussion
How to send a GET method with content data with M?
Hi fdanielsouza ,
let
content = "{
""method"": ""get"",
""params"": {
""SelectionCriteria"": {},
""FieldNames"": [""Id"", ""Name""]
}
}",
Source = Json.Document(Web.Contents("https://api.salaovip.com.br/reports/0005?page=1&limit=100", [Headers=[Authorization="Bearer AQAAAAANlKwBAAQQn4Wfgbxxxxxxxxxx"], Content=Text.ToBinary(content)]))
in
Source
try these code above with adjusted parameter Bearer etc. it should work
-------------------------------------------------------------------
Did I answer your question? Mark my post as a solution!
It was useful? Press Thumbs Up!
- fdanielsouza6 years agoHelper I
rainer1 , thank you for the help and sorry I'm replying late, please look if this is what you meant me to do, because it still raises the 405 status error
- artemus6 years agoMicrosoft Employee
Have you tried manual status handling? E.g.:
= Value.Metadata(Web.Contents("https://example.com", [ManualStatusHandling={405}, Content=Text.ToBinary("<Content>")]))[Content.Uri]()- fdanielsouza6 years agoHelper I
Artemus, thank you for your help. I can get the metadata after ManualStatusHandling, but I don't know where to go after that. Can't just use Web.Contents again using the Content.Uri, also can't use the Location header in the request because the response status isn't 300ish.
I think the solution would be using the WebAction.Request() function, but I always get an "We haven't been given permission to perform actions against this source" error on VS and "Object reference not set to an instance of an object" error on Power BI Desktop.