Extracting data for Shipping Information

I know this is possible (pretty sure) just not sure on the wording of how to ask/explain the question.

We are using POSTMAN to review the results of a call? to pull order data, example- in the post url field I insert an order number at the end of the url to get the results.

Then I switch it to a JSON view to easily view the results. This was set up by an outside source for us and I am just viewing/entering variables to view.

I am wondering if there is a way to extract these results without having to involve the “outside source” on our own.

We may be able to have UPS help, I just need the shipping information from our order data out the JSON.

Hey @jarett

Welcome to the community :trophy:

Would you be able to provide some visual examples of what you can see and the response bodies (remove or mask the sensitive data)?

This is the response data I see, the #7661705 at the end of the URL is the variable that determines what data is pulled into the response. I need just the “Ship to” fields.

For something simple to just logs the property and value to the console that starts with shipTo, you could use this:

const response = pm.response.json().salesOrdersHeader;
for (const [key, value] of Object.entries(response)) {
    if(key.startsWith('shipTo')){
        console.log(`${key}: ${value}`);
    }
}

Or this this add the values into an array:

const values = Object.entries(pm.response.json().salesOrdersHeader)
              .filter(([a]) => a.startsWith('shipTo'))
              .map(([,b]) => b);

console.log(values);

Thanks, trying to go through the tutorials to understand everything. Before diving any deeper, I’ve found out that we will need to produce a txt file. Problem is can you request “orders” during a certain time period and schedule the request and automate the export of the txt file. This is just from my creativity, I have no idea how to do this language wise, just learned how to write a bat script and schedule it in Task Scheduler. If I have a direction I will Google till I figure it out.