Forum Discussion

wabanek's avatar
wabanek
Frequent Visitor
7 years ago

Use cURL in PowerBi

Is it possible to connect dataset via cURL to PowerBI ?

I have cURL generate by graphql but not sure i I can use it somehow in PB

 

curl 'https://api.com/graphql' -H 'Accept-Encoding: gzip, deflate, br' -H 'Content-Type: application/json' -H 'Accept: application/json' -H 'Connection: keep-alive' -H 'DNT: 1' -H 'Origin: https://api.com' -H 'access_token: ' --data-binary '{"query":"# Write your query or mutation here\n{\n members{\n data{\n user{\n name\n }\n }\n }\n}\n"}' --compressed

 

4 Replies

  • wabanek's avatar
    wabanek
    Frequent Visitor

    So far I managed to create below m code but i doesnt work. Im newbie to M language, can someone support me with it?

     

    let
        apiUrl = "https://apiname.com/graphql",
        options = 
            [Headers =[#"Content-Type"="application/json", #"Subscription-Key"="<my token>"],
            Content = Text.ToBinary({"query:{\n  members{\n    data{\n      user{\n        name\n      }\n    }\n  }\n}\n"})
        ],
        Content = options[Content]
    in
        Content

    Error message: We cannot converte List type to Text type

     

    • v-juanli-msft's avatar
      v-juanli-msft
      Community Support

      Hi wabanek 

      Do you want to connect to the Microsoft Graph Security API?

      If so, please follow this this article to use the Microsoft Graph Security connector of Power BI Desktop.

       

      If you'd like to connect to your secure API like this article

      In the editor, enter the API’s address and any header information needed for that api.

      After this, when a warning message pops up, Click “Edit Credentials”

      let

           apiUrl = "https://xxxxxxx/api/info",

           options = [Headers =[#"Subscription-Key"="xxxxxxxxxxxxxxxxxxxxx"]],

           result = Web.Contents(apiUrl , options)

      in

           result

       

       

      Best Regards
      Maggie

       

      Community Support Team _ Maggie Li
      If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

      • wabanek's avatar
        wabanek
        Frequent Visitor

        Thanks Maggie for you reply. I'm Trying to connect to secure Api, tried your step and not sure how to move further, could you advise