cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
IAQG
Advocate I
Advocate I

How to retrieve a specific field in a web service response?

Hi all,

 

I'm just starting to use the Invoke Web Service step, and I was wondering if there's a way to retrieve a specific field from a response? For example, if I send a GET call that pulls back a customer's information with fields like "First Name", "Last Name", and "Address", how do I pull just the first name from the response? I know I could probably write a substring that gets specific characters, but that seems a bit messy and unreliable. In other programming spaces it would be something like Response.Data("First Name") or something of the sort.

 

Thanks for the help.

EDIT: I should mention that this is a REST call using JSON.

1 ACCEPTED SOLUTION

Accepted Solutions
IAQG
Advocate I
Advocate I

Thanks for responding. It is a REST call with a JSON response, I should have mentioned that. I did not know about the JSON to object step, so that helped get me to where I needed to be. Thanks.

 

For the example, though, I did try your method of %response%[0], and that gave me a concatenation instead of a response, and putting the [0] inside the symbols didn't work either. For me the successful format was %response.first_name%.

Thanks for the help, though, you definitely put me on the right path.

View solution in original post

2 REPLIES 2
PBrt
Frequent Visitor

Hi,

 

I guess it depends on what webservice you are using. Generally, REST webservices get you a JSon response.

If so you can use "convert Json to custom object" function that will essentially create a list object that you can then parse easily (exemple %response%[0] to get first element).

 

If your response is a XML file there are also a lot of premade option to parse XML files in PAD.

 

However you should keep in mind that REST webservices won't always get you an answear with the same structure, for exemple "first name" might not be in the response from the server. So when you parse your custom object you may have errors if you try to get something that doesn't exist.

 

Best regards

IAQG
Advocate I
Advocate I

Thanks for responding. It is a REST call with a JSON response, I should have mentioned that. I did not know about the JSON to object step, so that helped get me to where I needed to be. Thanks.

 

For the example, though, I did try your method of %response%[0], and that gave me a concatenation instead of a response, and putting the [0] inside the symbols didn't work either. For me the successful format was %response.first_name%.

Thanks for the help, though, you definitely put me on the right path.

View solution in original post

Helpful resources

Announcements
MPA_User Group Leader_768x460.jpg

Manage your user group events

Check out the News & Announcements to learn more.

Community Connections 768x460.jpg

Community & How To Videos

Check out the new Power Platform Community Connections gallery!

Welcome Super Users.jpg

Super User Season 2

Congratulations, the new Super User Season 2 for 2021 has started!

Carousel 2021 Release Wave 2 Plan 768x460.jpg

2021 Release Wave 2 Plan

Power Platform release plan for the 2021 release wave 2 describes all new features releasing from October 2021 through March 2022.

Top Solution Authors
Top Kudoed Authors
Users online (2,375)