json - REST complex response -


i have created rest service jax-rs , resteasy , have 1 post method it.

here code service:

@path("/service") public class ws {     @post     @path("/device")     @consumes(mediatype.application_json)     @produces(mediatype.application_json)     public response senddevices(list<device> devicelist) throws ioexception, urisyntaxexception {          list<device> resultlist = new arraylist<device>();          // response simple message         string message = "simple response";         return response.status(200).entity(message).build();     } } 

i posting arraylist of devices , @ moment getting response string message states whether creation of resource successfull.

here json using test service, list 1 device only:

[{"id": 1,   "serial" : "s1234",   "type":"sometype",   "timestamp":2342344,         }] 

now want change response , make more complex. reponse holds 2 arraylists. these arraylists should hold ids of devices posted (status 200) , other list holds ids of devices not posted (status 400).

i not know how solve problem though. have post each device 1 one? or how achieve goal? know have write new class holds 2 arrays field.


Comments