Using results from one post to populate another

Hi all -

I’m not only new to Postman, but I’m relatively unfamiliar with HTTP (I’m an embedded software engineer), so please bear with me on this.

I recently started using Postman to create messages that I send to a server, which relays a similar command to an embedded device. (Postman doesn’t talk directly to the device.) Many of my commands cause the device to reset. When the device resets and reconnects, it will connect to one of several servers in the server bank. I need to know the IP address of the server to which my device is connected.

Currently, I have to use a page that will tell me the current server IP address, and manually edit that address into my Postman command. This is quite inconvenient.


The key used above is already stored in a Postman variable.

I’d like to create a command that performs the equivalent of the above page, and places the IP address into a variable that I can use in my Postman commands, which are currently formed like this:

http://ip-10-182-39-115.ec2.internal:6090/(the rest of the command goes here)

Can someone advise me on 1) whether this is feasible, and 2) how to go about implementing it?

Thanks…

Hi @mpzimmers

The output you see in that “Results” box, can that be replicated via an API call?
(It kinda looks like a windows form rather than a browser, but I might be wrong??)
If you can use an API call, you could use Postman Interceptor to record what gets sent.

If you can get the response via an API call in Postman then you can use a “Test” script to grab the data returned. For example;

const response = pm.response.json();
pm.collectionVariables.set("variable_key", response.serverIP);

Note: the above code would be dependent on how the data is returned.

Hi @w4dd325 -

The picture I included above is a snap of part of a browser window.

(As a tangential question, I’ve tried using Wireshark to show me the actual message being passed when I hit “Search…” but I don’t see the message. Is there perhaps a better tool for capturing the message?)

Postman Interceptor that I linked above is the Postman proxy recorder. (similar to wireshark).

Do you by any chance have the ability to trigger the call via cURL command? You can import cURL straight into Postman.

I’ve tried Interceptor a couple times; it’s picking up some traffic, but not my Postman-generated messages. For example, it doesn’t “see” this:

https://r-api.zodiac-{{environment}}.com/devices/{{serial_number}}/control.json?api_key={{api_key}}&authentication_token={{auth_token}}&user_id={{user_id}}&command=/command&params=request=7864010805

I’ve even tried to use the “URL must contain” filter, but to no avail. Any idea why Interceptor isn’t seeing the traffic I’m generating from Postman?

I’ve never used cURL, so I’m not sure what I would do with this.

Thanks…