Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Earn the coveted Fabric Analytics Engineer certification. 100% off your exam for a limited time only!

Reply
wabanek
Frequent Visitor

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 4
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

 

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.

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

 

Przechwytywanie.PNG


Hi Again, 

 

Could you check below why Im getting below error?

 

Przechwytywanie.PNG



let Source = Web.Contents( "https://api.com/graphql", [ Headers=[ #"Method"="POST", #"Content-Type"="application/json", #"Authorization"="Origin: https://api.com' -H 'access_token: <my token>" ], // Notice the quote escaping here Content=Text.ToBinary("{""query"":""{ invoices{data{number}}}""}") ] ), #"JSON" = Json.Document(Source) in #"JSON"
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: <my token>' --data-binary '{"query":"# Write your query or mutation here\n\n{\n  invoices{\n    data {\n      number\n      \t}\n      \n    }\t\n  }\n\n"}' --compressed

 

Helpful resources

Announcements
April AMA free

Microsoft Fabric AMA Livestream

Join us Tuesday, April 09, 9:00 – 10:00 AM PST for a live, expert-led Q&A session on all things Microsoft Fabric!

March Fabric Community Update

Fabric Community Update - March 2024

Find out what's new and trending in the Fabric Community.

Top Solution Authors
Top Kudoed Authors