Search code examples
restapi-design

RESTful API - refresh specific resources operation


I have a set of resources:

[{
"name": "process-1",
"id": "1",
"state": "active"
},...
]

I get them by GET service-name/version/processes?state=running&sort=by_date

I need to update the set: update state in existing processes and get new running processes. How should I design this API according to RESTful best practice?

Is it a good solution to design it by the following way:

POST service-name/version/processes?action=refresh

body: {ids: ["1", "2", "3", ...]}

or should I implement refresh as external resource-operation?

UPDATE:

I don't want to update objects on server side, I just want to refresh them on client side


Solution

  • If this is a strictly client-side problem, you don't need any new HTTP endpoints. You just do the same GET request again.