How can I generate this payload automatically in postman. Please see the structure below.
I am only changing Account Number / Account Name in the payload. If I have add 200 accounts for a customer ID I would have to insert 200 separate structures in the array. Is there a better way to maintain and generate the payload on the fly as I know that only 2 fields are changing and I could pass these as variables. I tried the Collection Runner but I am unable to send these as one request.
FYI - For another corporate it would be 100 or 50 or 500, I wish to use the same payload for any request.
FYI- need to pass all these accounts in one request is because any second request its treated as a modify by the server.
{
"context": {
"EID": "ACC_123",
"eventTime": "2018-01-02T00:00:00.000Z",
"Eaction": "INIT"
},
"payload": [
{
"accountNumber": "12345",
"accountName": "abcd",
"accountAliasName": "",
"customerId": "150740000",
"ccy": "THB",
"accountStatus": "A",
"branch": "001",
"bankCode":"0001"
},
{
"accountNumber": "123456",
"accountName": "abcde",
"accountAliasName": "",
"customerId": "150740001",
"ccy": "THB",
"accountStatus": "A",
"branch": "001",
"bankCode":"0001"
}
]
Updated-
Pre-req:
payloadarr.push(
{
"accountNumber": Account_Number ,
"accountName": Account_Name,
...
"context": {
"eventID": "TEST_JSL_0120191",
"eventTime": "2018-01-02T00:00:00.000Z",
"action": "INITIATE"
},
"payload": [payloadarr]
Body:
{{AccountActivation_Payload}}
...
Request passed:
{"context":{"eventID":"TEST_JSL_0120191","eventTime":"2018-01-02T00:00:00.000Z","action":"INITIATE"},"payload":[[]]}
Expectation: payload should have the appended values
{"context":{"eventID":"TEST_JSL_0120191","eventTime":"2018-01-02T00:00:00.000Z","action":"INITIATE"},"payload":[{
"accountNumber": "12345",
"accountName": "abcd",
"accountAliasName": "",
"customerId": "150740000",
"ccy": "THB",
"accountStatus": "A",
"branch": "001",
"bankCode":"0001"
},]}