Home > Software design >  How to send array as parameter in API Call?
How to send array as parameter in API Call?

Time:10-31

How to send array as parameter in API Call?

I just want to know how can I pass and array as parameter in Java,

Like:-

 "list":[
              {
                 "name":{{$randomFullName}}, 
                 "account":{{$randomAlphaNumeric}},
                 "accountbalance":{{$$randomInt}}
                  
              }

    "Message":  "Dear {{name}}, your {{$accountnumber}} has been credited with Rs.{{($accountbalance)}}.

}

I just want to pass name, account, account-balance in the message body.



CodePudding user response:

it doesn't work that way . You can't use a parameter as an object in a request body . Instead , you should extract the list in your code and then send message accordingly in code only .

CodePudding user response:

Your question seems to be a bit unclear.

If you just want to set the values during runtime, before sending the request, you need to set the environment and add these as the variables in the postman.

Or if you're trying to build the whole list dynamically, then you can write the complete code for that in the request script and simply use that while sending the request. This can help you with the same.

  • Related