Some advice about REST endpoints design

229 Views Asked by At

Currently we have some endpoints which are essentialy a PATCH but the request is to not leverage on JSONPatch o JSONMergePatch objects because endpoints must have specific DTOs as body. My idea is to have the same @PATCH endpoint consumes different types:

@Path("path/to/resource")
@PATCH
@Consumes(???)
void modificationOne(DTO#1 modifications) {
}

@Path("path/to/resource")
@PATCH
@Consumes(???)
void modificationTwo(DTO#2 modifications) {
}

I'm struggle about @Consumes() media type:

  • application/vnd.patch.modificationOne+json, application/vnd.patch.modificationTwo+json
  • application/json-patch+json; type=DTO#1, application/json-patch+json; type=DTO#2

Anyone with some advices for a better and/or more pratical solution?

0

There are 0 best solutions below