Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.
Register now!The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more
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
The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!
| User | Count |
|---|---|
| 19 | |
| 9 | |
| 8 | |
| 7 | |
| 6 |