Accepting a resource update for processing while changing other attributes not mentionned in the original request

Here are two possible responses from a PATCH request.

202 Accepted

If an update request has been accepted for processing, but the processing has not been completed by the time the server responds, the server MUST return a 202 Accepted status code.

200 OK

If a server accepts an update but also changes the resource(s) in ways other than those specified by the request (for example, updating the updated-at attribute or a computed sha), it MUST return a 200 OK response. The response document MUST include a representation of the updated resource(s) as if a GET request was made to the request URL.

A server MUST return a 200 OK status code if an update is successful, the client’s current attributes remain up to date, and the server responds only with top-level meta data. In this case the server MUST NOT include a representation of the updated resource(s).

What should the response be if I wanted to process the request later, but more attributes than those mentioned in the first request are going to be updated?

Also, once a request is accepted (202), is it allowed to end up failing?

A 202 does not imply the overall request processing was successful. It should also return a location header which would be queried by the client. This location URL would then be responsible for conveying information about the failure of the request via the appropriate response codes.

Based on this line of questioning, I’m assuming your service is not a database or document store. You also shouldn’t think of the API as a thin facade on top of either of those, but the layer where you should encapsulate as much business or domain logic as possible. The service is allowed to do whatever it wants to resources at any time as it chooses. Resources can be deleted, moved or adjusted all without requiring any interaction with a client.

Resources are not objects, and HTTP Requests are not Remote Procedure Calls. If you do not understand either of those points, it would be very beneficial for you to research them to understand. I have written a few posts on the subject to give an understanding of this here and peppered within my hypermedia api guidelines here.

I hope this helps!

Thanks @michaelhibay

So to make those two statements consistent, you could say that you accept the request as is, but you will store the new resource later. You respond with 202.

Only when the resource actually gets stored you decide to change some attributes.