cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Arshad80
Regular Visitor

Get IP Address in a string to call an API in the next step

Hi,

My flow is returning data in this format below, i just want to get each ip address in a for each loop so that i can use it in the step to call an API.

 

[
  "[\n  ",
  "172.21.43.10",
  ",\n  ",
  "189.75.212.28",
  "\n]\n\n[\n  ",
  "161.225.29.22",
  "\n]\n\n[\n  ",
  "169.225.222.243",
  "\n]\n\n[\n  ",
  "165.235.238.260",
  "\n]\n\n\n\n\n\n\n\n\n\n"
]

 

i just want each ip as a value so that i can call my API.

 

Regards

1 ACCEPTED SOLUTION

Accepted Solutions
Paulie78
Super User
Super User

Like this should work:

https://ibb.co/9NghKqX

FilterIPAddresses.png

The output of the filter array is like this when it is executed:

FilteredIPAddresses.PNG

The expression in the filter array action is simply:

indexOf(item(), '.')

This filters the array to contain only those that contain a dot, which means there is an IP address there. You then have a clean array you can use in your foreach loop.

 

Please...

If I answered your question Accept it as a solution ✔️ 

If I helped you out, please give me some Kudos 👍

Thanks 😙

 

View solution in original post

4 REPLIES 4
Paulie78
Super User
Super User

Like this should work:

https://ibb.co/9NghKqX

FilterIPAddresses.png

The output of the filter array is like this when it is executed:

FilteredIPAddresses.PNG

The expression in the filter array action is simply:

indexOf(item(), '.')

This filters the array to contain only those that contain a dot, which means there is an IP address there. You then have a clean array you can use in your foreach loop.

 

Please...

If I answered your question Accept it as a solution ✔️ 

If I helped you out, please give me some Kudos 👍

Thanks 😙

 

Thanks for your reply and i got array now; but i would like to get IP address for next step, this give me an array of IP's. how could this be break down in a single IP address for next step.

 

Thanks for your help

As I showed in my flow screenshot, you have an array, which is a list of IP Addresses, you then use them in an apply to each loop. Take another look at the screenshot I produced. Use the "body" of the array in the apply to each then you can access the IP address with the value of "item()"

 

Or do you want a single delimited string of IP addresses? Like:

 

172.21.43.10;189.75.212.28...

oh sorry i got it i was able to do it with your instructions.

Helpful resources

Announcements
Register for a Free Workshop.png

Register for a Free Workshop

Learn to digitize and optimize business processes and connect all your applications to share data in real time.

September Events 2022

Check out all of these events

Attend in person or online, there are incredible conferences and events happening all throughout the month of September.

Users online (2,746)