Forum Discussion

Ballzer0's avatar
Ballzer0
New Member
6 years ago

POST to Rest API while being authenticated with Organizational account

when i do a request like this

let
Kilde = Web.Contents("https://myAPI.com/that/requires/organizational/account", [Content=Text.ToBinary("json goes here")])
in
Kilde

 ill get an error saying i have to be connected anonimously to add content.

then i tried using WebAction.Request instead, but it just crashes with an unexpected error.

 

 


let
Kilde = WebAction.Request(WebMethod.Post, "https://myAPI.com/that/requires/organizational/account", [Content=Text.ToBinary("json goes here")])
in
Kilde

If anyone has any examples on how to use WebAction.Request, it would be highly appreaciated. or any other ways of sending a post request with some json to an API 

4 Replies

  • dax's avatar
    dax
    Community Support

    Hi Ballzer0 , 

    When you use web connector to connect this datasource, you should choose corresponding authentication type when connecting(you could delete the permission from edit queries->datasource setting, then re-connect it and choose corresponding credential type).

    Or you also could pass the auth-token in it. 

     You could refer to Working with Web Services in Power Query  for details.

    Best Regards,
    Zoe Zhi

    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

    • Ballzer0's avatar
      Ballzer0
      New Member

      this datasource needs to log who uses it. so they would not be able to give me an authorization token. The system admin said its a NO-Go unless i have user auth.

      • miguel's avatar
        miguel
        Community Admin

        Hey!

        Your best course of action would be to create a Power BI Custom Connector. That would be the most ideal scenario.

        Best!