Power BI is turning 10! Tune in for a special live episode on July 24 with behind-the-scenes stories, product evolution highlights, and a sneak peek at what’s in store for the future.
Save the dateEnhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.
Hello and good day everyone,
I've been trying for 3 days to connect to an API using Post Method. I been using different methods that I found on some forums but still I can't get the correct result.
This is what I got:
-URL: https://e-api.gemius.com/api/markets
-Authentication Token : Bearer XXXXX
-JSON response from postman:
let
AuthKey = "Bearer XXX",
url = "https://e-api.gemius.com/api/markets",
body = {id="2", iso="be", name="be"},
Source = Json.Document(Web.Contents(url,[
Headers = [#"Authorization"=AuthKey ,
#"Content-Type"="application/json"],
Content = Text.ToBinary(body)
]
))
in
Source
I don't have a lot of experience working with API's if someone can help me it would be wonderfull.
Thx!
Hi @niculcig ,
the Power BI /Power Query /M-syntax to create a record or a list is quite the opposite of how you do it in JSON.
So step
body = {id="2", iso="be", name="be"},
in your query is not valid.
To create this record in M, you have to use square brackets instead:
body = [id="2", iso="be", name="be"]
Imke Feldmann (The BIccountant)
If you liked my solution, please give it a thumbs up. And if I did answer your question, please mark this post as a solution. Thanks!
How to integrate M-code into your solution -- How to get your questions answered quickly -- How to provide sample data -- Check out more PBI- learning resources here -- Performance Tipps for M-queries
Check out the July 2025 Power BI update to learn about new features.
This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.
User | Count |
---|---|
10 | |
7 | |
7 | |
6 | |
6 |