Use the following annotations when creating resource classes:
@Path
– When you create a root resource, you must provide the@Path
annotation. The annotation contains the URI path for the resource. For example,@path ("/cart")
. Note: If you are creating a sub-resource, ensure that there is no@Path
annotation.@RestResource
– The@RestResource
must be present for all resource classes, as it specifies the ID of the resource. The ID is a string that uniquely identifies the resource and does not change when the context and/or version change.