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

Learn from the best! Meet the four finalists headed to the FINALS of the Power BI Dataviz World Championships! Register now

Reply
jguieze
New Member

Call a JSON POST API with parameters

Hi all,

 

I'm not a developper at all more than a newbie, just scripting some very simple things sometimes.

As I have time right now I try to play with API of my company Contact Center software to generate some reports.

 

I succeed to call API from Postman and import JSON into Powerquery now I'd like PowerQuery to directly call the API. I tried a lot of different things but till now I did not succeed.

 

Maybe someone coudl help me "translate" this cURL into M language ?

curl --location --request POST 'https://website.domain/api/call/in/histories' \
--header 'Authorization: Basic authkey \
--header 'Content-Type: application/json' \
--data-raw '{
    "startDate": "2020-03-01 00:00:00",
    "endDate": "2020-03-24 23:59:59"
}'

 

Thans a lot for your help

Jérôme

4 REPLIES 4
Anonymous
Not applicable

I will be able to answer to this question since I had a similiar requirement and i was able to connect pull data successfully.

scripts you need to execute:

let

body = Json.Document("{
""startDate"": ""2020-03-01 00:00:00"",
""endDate"": ""2020-03-24 23:59:59""
}"),
response = Web.Contents("https://website.domain/api/call/in/histories", [Headers=[#"X-API-KEY"="paste your x-api-key here", #"Content-Type"="application/json", Cookie="paste your cookie here it is optional if not available remove this"],Content=Json.FromValue(body)]),
jsonResponse = Json.Document(response),
records = jsonResponse[records]
in
records

 

Hope this helps. Please accept it as a solution if it helped. If not provide your queries if will try to help you solve it

ale-hd
Helper I
Helper I

Hi Jerome, I am having the same identical issue than yours, did you solve it? If yes can you tell me how? Regards, Alessandro

blopez11
Super User
Super User

I think this post may be able to help you with what you are trying to accomplish: https://eriksvensen.wordpress.com/2014/09/15/specifying-json-query-in-power-query-example-statistics...

 

Good luck,

I've already read this post but I'll drill a little more. 

 

Thanks,

Helpful resources

Announcements
Join our Fabric User Panel

Join our Fabric User Panel

Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.

February Power BI Update Carousel

Power BI Monthly Update - February 2026

Check out the February 2026 Power BI update to learn about new features.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Solution Authors