sweetcode
sweetcode

Reputation: 159

How to construct REST dto's?

I am in the process of building a REST api which accepts a set of arguments, processes it and gives a boolean response.

My question is how do I build a dto object. I can create a Java POJO in one of the applications and use it as REST parameter but that creates a dependency on this application. Is there a better way to pass an object as REST parameter?

note: the reason I am not using path params because my dto object might contain a list of objects as well and I am not sure how to pass that using path param.

Upvotes: 1

Views: 786

Answers (1)

Jimmy T.
Jimmy T.

Reputation: 4190

You can create a library which contains the DTO class if dependency is your concern.

After all the DTO is dependent on the REST API. If one changes the other must change too.

Upvotes: 1

Related Questions