restsitebricks

How to sends multiple object over JSON from sitebricks client to sitebricks REST Service?


Is it possible to sends two or more object simultaneously from sitebricks client to sitebricks service ?

For example, I have a Person Object and a JobApplication Object. Can I do something like this:

public class ApplicationStorage {

    @Post
    public void post(Person person, JobApplication job) {
        // ...
    }    
}

WebClient client = web.clientOf("service url") ..... // here how to send the two objects ? 

Solution

  • If sending two objects is a must, then create another object that is composed of the two objects that you wish to send over HTTP. Your JSON parser (ex: Jackson) will be able to serialize each of the first two objects into JSON, and set them as JSON attributes to your new object.