Forum Discussion

lamiae's avatar
lamiae
New Contributor
5 years ago

create list of object in one Rest request

Hi everbody, 

 

am new to SOAPUI & GROOVY Script, 

 

I would like to create a request test with a list of object "car" in one REST request.

I'm able to read raw from excel file and I don't know how to create the request with groovy code and save the result in a file.

 

Here the request definition  (Json form) :

{
"idCar" : "string",
"idUser" : "string",
"idTypeCar" : "string",
categories : [

{ "idCategorie" : "string", 

   "nameCategorie": "string"}

]

}

 

I need to send a request like : 

{

{
"idCar" : "id1",
"idUser" : "0",
"idTypeCar" : "Immatriculé",
categories : [

{ "idCategorie" : "id01", 

   "nameCategorie": "cat01"}

{ "idCategorie" : "id02", 

   "nameCategorie": "cat02"}

]

}

 

{
"idCar" : "id2",
"idUser" : "2",
"idTypeCar" : "Immatriculé",
categories : [

{ "idCategorie" : "id02", 

   "nameCategorie": "cat02"}

{ "idCategorie" : "id03", 

   "nameCategorie": "cat03"}

]

}

}

 

Thank you in advance.

  • nmrao's avatar
    nmrao
    Champion Level 3
    Would you mind showing how the data is structured in the data source file? A sample file attachment or a screen shot possible?