Hi Team and Beautiful Community
Problem:
I want to fetch from data file (JSON) in the collection Runner an array of object;
Scenario:
I have my collection in the main app here the body with all the fields that are parameterized
{
"order": {
"order_date": "{{order_date}}",
"order_number": "{{order_number}}",
"reference": "{{reference}}",
"shipping_method": "{{shipping_method}}",
"signature_required": {{signature_required}},
"destination": {
"name": "{{name}}",
"phone": "{{phone}}",
"email": "{{email}}",
"company": "{{company}}",
"building":"{{building}}",
"street": "{{street}}",
"suburb": "{{suburb}}",
"city" : "{{city}}",
"state": "{{state}}",
"post_code": "{{post_code}}",
"country": "{{country}}",
"delivery_instructions": "{{delivery_instructions}}"
},
"items": [
{
"description": "My Item",
"sku": "ItemA",
"quantity": 1.0,
"weight": 0.60,
"value": 25.0
}
]
}
}
As you can see order.fields are all parameterized and i can fetch a lot of different data for many iterations i like and i can interact dynamically with the underlying API ;
However the array of object/s items is static ;
this below is my data file example (i have just paste one scenarios but i have a files with 50).
[
{ "signature_required": true,
"reference": "Test1",
"shipping_method":"express",
"order_number": "{{randomOrderNumber}}",
"order_date" : "{{$timestamp}}",
"name" : "Company + Building + City",
"phone" : "00000000",
"email": "[email protected]",
"company": "My Company",
"building": "My Building",
"street": "20 Wellington Street",
"suburb": " Bondi",
"post_code": "2026",
"state": "NSW",
"city": "Sydney",
"country": "Australia",
"delivery_instructions": "Leave at front-door"
},
....
....
....
]
IS THERE ANY WAY I CAN ADD AN ARRAY OF 1 OR MORE OBJECTS WITH DIFFERENT VARIABLES IN THE DATA FILE TEMPLATE I HAVE CREATED?
maybe something like this:
[
{ "signature_required": true,
"reference": "Test1",
"shipping_method":"express",
"order_number": "{{randomOrderNumber}}",
"order_date" : "{{$timestamp}}",
"name" : "Company + Building + City",
"phone" : "00000000",
"email": "[email protected]",
"company": "My Company",
"building": "My Building",
"street": "20 Wellington Street",
"suburb": " Bondi",
"post_code": "2026",
"state": "NSW",
"city": "Sydney",
"country": "Australia",
"delivery_instructions": "Leave at front-door"
"items":[
{
"description": "My Item1",
"sku": "Item1",
"quantity": 1.0,
"weight": 0.60,
"value": 25.0
},
{
"description": "My Item2",
"sku": "Item2",
"quantity": 1.0,
"weight": 0.60,
"value": 25.0
},
]
},
....
....
....
]
what would be the code in the request template ? thinking that the request templates will adapt either with 1 item or maybe 2 -3 or more . I am not sure is supported yet.
"${items}": [
{
"description": "{{desc}}",
"sku": "{{sku}}",
"quantity": {{qty}},
"weight": {{wgt}},
"value": {{value}}
}
]
and what would be the code in the data_file.json ?
thanking you in anticipations for an early reply
Franco