Power BI is turning 10, and we’re marking the occasion with a special community challenge. Use your creativity to tell a story, uncover trends, or highlight something unexpected.
Get startedJoin us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.
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
This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.
Check out the June 2025 Power BI update to learn about new features.
User | Count |
---|---|
8 | |
6 | |
6 | |
6 | |
5 |
User | Count |
---|---|
9 | |
9 | |
8 | |
6 | |
6 |