cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
andycreigh
Helper I
Helper I

API Call using Http including body json

Hi All,

 

I'm trying to create an API call to get some basic details on classes.

 

I had this working in 5 minutes in Postman but seem to be struggling in Power Automate.

 

I have to provide filters in the call otherwise the dataset is too large.

 

In Postman i just add this code into the body request of the call and all works fine.

 

14-12-2021 17-40-25.jpg

 

In Automate though this doesn't work.

 

14-12-2021 17-37-36.jpg

If i use the above i get the error

 

The provided 'Http' action inputs are not valid. A request body must not be included for 'GET' requests.

 

If i try to include in The Queries section as below

 

14-12-2021 17-42-49.jpg

I then get the error 

 

Unable to process template language expressions in action 'GET_CLASSES_FOR_TODAY' inputs at line '1' and column '6027': 'Error reading string. Unexpected token: StartObject. Path 'queries.unified_filters'.'.

 

Any help on what I'm doing wrong greatly appreciated.

 

Andy

5 REPLIES 5
ManishJain
Solution Sage
Solution Sage

Hi @andycreigh ,

 

Are you sure it is GET Call you are making in Postman and it is returning data. Also there is code button at the top right in Postman so if you are not sure why it is not working this comes as handy.

 

ManishJain_0-1639517514792.png

Thanks

andycreigh
Helper I
Helper I

@ManishJain 

 

Thanks That code View will come in really useful.

 

It's def a GET call in postman. Here is a screen shot including the data returned in postman.

 

postman.jpg

I have this same API returning data in MS Automate where it doesn't need the filters, so i know the API call works in principal in MS Automate.

 

It's knowing where to put the bit at the bottom that i think is the issue.

 

{"unified_filters": {
"since": "2021-12-14T01:33:04Z",
"till": "2021-12-14T22:33:04Z",
"service_category_id": 13
}}

 

I have tried all the options i can think of. The below for example doesnt work.

 

14-12-2021 22-09-56.jpg

The code doesn't look like it stays in Json format if i peek the code

 

14-12-2021 22-11-23.jpg

 

 

Andy

 

Hi @andycreigh ,

 

Two options from here : 

1. Send your data in Query but with a slight modification : 

 

"unified_filters" =  {
"since": "2021-12-14T01:33:04Z",
"till": "2021-12-14T22:33:04Z",
"service_category_id": 13
}

 

2 . Encode this part 

{
"since": "2021-12-14T01:33:04Z",
"till": "2021-12-14T22:33:04Z",
"service_category_id": 13
}

using Base64Tostring function and add that to query part 

"unified_filters" = encodedstring 

 

Let me know if these works.

 

Thanks

Hi @ManishJain 

 

I'm not sure how to do option 2 or at least couldn't work it out. 🙂

 

Option 1 though i have set up like this. Is this right?

 

15-12-2021 15-45-47.jpg

 

But I get a 406 error as below.

 

 
 

15-12-2021 15-45-35.jpg

 

I really appreciate your help with this 

 

Andy

 

Hi @ManishJain 

 

I'm not sure how to do option 2 or at least couldn't work it out. 🙂

 

Option 1 though I have set up like this. Is this right?

 

15-12-2021 15-45-47.jpg

 

But I get a 406 error as below.

15-12-2021 15-45-35.jpg

 

I really appreciate your help with this 

 

Andy

 

Helpful resources

Announcements
Microsoft 365 Conference – December 6-8, 2022

Microsoft 365 Conference – December 6-8, 2022

Join us in Las Vegas to experience community, incredible learning opportunities, and connections that will help grow skills, know-how, and more.

Difinity Conference 2022

Difinity Conference 2022

Register today for two amazing days of learning, featuring intensive learning sessions across multiple tracks, led by engaging and dynamic experts.

European SharePoint Conference

European SharePoint Conference

The European SharePoint Conference returns live and in-person November 28-December 1 with 4 Microsoft Keynotes, 9 Tutorials, and 120 Sessions.

Users online (2,607)