Hi!
Very new to APIs and Postman. I’m using the app and haven’t figured out how to run from terminal just yet.
I’m trying to run a collection of requests where the first request is a GET and the second request is a POST.
I need to save part of the GET response (JSON) if criteria is met. Here is the GET response:
{
"fulfillment_orders": [
{
**"id": 6047600705718,**
"shop_id":,
"order_id":,
"assigned_location_id": 67016458422,
"request_status": "unsubmitted",
"status": "open",
"supported_actions": [
"create_fulfillment",
"move",
"hold"
],
"destination": {
},
"line_items": [
{
"id": 12762842955958,
"shop_id":,
"fulfillment_order_id": 6047600705718,
"quantity": 0,
"line_item_id": 12599283417270,
"inventory_item_id": 44438930358454,
"fulfillable_quantity": 0,
**"variant_id": 42352914890934**
},
{
"id": 12762842988726,
"shop_id":,
"fulfillment_order_id": 6047600705718,
"quantity": 1,
"line_item_id": 12599283450038,
"inventory_item_id": 44442032046262,
"fulfillable_quantity": 1,
**"variant_id": 42356009107638**
}
],
"fulfill_at": "2023-08-27T06:00:00-04:00",
"fulfill_by": null,
"international_duties": {
"incoterm": null
},
"fulfillment_holds": [],
"delivery_method": {
"id": 595030343862,
"method_type": "shipping",
"min_delivery_date_time": null,
"max_delivery_date_time": null
},
"created_at": "2023-08-27T06:13:39-04:00",
"updated_at": "2023-08-27T06:13:39-04:00",
"assigned_location": {
},
"merchant_requests": []
},
{
**"id": 6070784295094,**
"shop_id":,
"order_id": 5024240402614,
"assigned_location_id": 68198531254,
"request_status": "unsubmitted",
"status": "open",
"supported_actions": [
"create_fulfillment",
"move",
"hold"
],
"destination": {
},
"line_items": [
{
"id": 12809295921334,
"shop_id": ,
"fulfillment_order_id": 6070784295094,
"quantity": 1,
"line_item_id": 12599283417270,
"inventory_item_id": 44438930358454,
"fulfillable_quantity": 1,
**"variant_id": 42352914890934**
}
],
"fulfill_at": "2023-08-27T06:00:00-04:00",
"fulfill_by": null,
"international_duties": {
"incoterm": null
},
"fulfillment_holds": [],
"delivery_method": {
"id": 612141924534,
"method_type": "shipping",
"min_delivery_date_time": null,
"max_delivery_date_time": null
},
"created_at": "2023-09-14T20:51:23-04:00",
"updated_at": "2023-09-14T20:51:23-04:00",
"assigned_location": {
},
"merchant_requests": []
}
]
}
I only want the ID number (in **s above) saved as a variable if the “line_items” “variant_id” (also in bold) is any of the following numbers:
42356009140406
42356009173174
42356009107638
42356009205942
42356009238710
In the example response above, there are two IDs, but only one meets the criteria (6047600705718, the second ID 6070784295094 does not meet the criteria). I’d want that ID to be put in a variable called {{fulfillment_order_id}} which is used in the next request in the collection.
Appreciate any help!