Given a resource
id: string;
name: string;
createdDate: number;
consumedDate: number; // unix
rejectedDate: number;
If I have some logic related to rejectedDate, can I use a rest Patch Method to update only rejectedDate?
Like PATCH /resource/:id/rejectedDate
body: { rejectedDate: '2020-01-01' }
Is this bad practice?
You can use
ROUTE: /resource/:id
METHODE: PATCH
BODY: { rejectedDate: '2020-01-01', .... other fields to update if needed }
Actually, the best practice is to have
/resources
- for the getting a list/resources/:id
- for the getting by id/resources
- for the creating a new one/resources/:id
- for the partially updating/resources/:id
- for the complete replacement of the item/resources/:id
- for removing item by id