java - is it an anti-pattern to use more than one method for sending information in a RESTful POST -
this so answer thoroughly goes through possible methods of passing , accessing parameters in restful post method.
is anti-pattern use more 1 method?
for instance consider following method passes json object in content body of post http method , uses path parameter anti-pattern?
@post @path("/modifyperson/{idx}") @consumes(mediatype.application_json) public response modifyperson(person newperson, @pathparam("idx") int i) { // ... }
i create richer class (e.g. personwithidx
) combines both person
, idx
integer parameter , pass instead no need resort path parameters. thing above code buys me obviates need create class. sound?
is anti-pattern use more 1 method?
no.
for instance consider following method passes json object in content body of post http method , uses path parameter anti-pattern?
no.
if have large number of resources share same backing implementation, using uritemplate identify how messages consume particular http request appropriate.
i create richer class (e.g.
personwithidx
) combines bothperson
,idx
integer parameter , pass instead no need resort path parameters. thing above code buys me obviates need create class. sound?
taking identifiers out of uri pack them request body sounds more rpc sounds rest.
Comments
Post a Comment