In RESTful world, how does next allowed action returned back to UI in a workflow based application

StackOverflow https://stackoverflow.com/questions/17726430

  •  03-06-2022
  •  | 
  •  

Domanda

We have a workflow based application where a given process move from one state to another state based on User action.Currently our requirement is to have UI displayed its current state and allow user to take next action steps.So my question is does generally server tells UI the next actions that can be taken or the UI should decide based on current action? This application is designed using RESTful webservices.

È stato utile?

Soluzione

The server should provide the client the next allowed actions, also known as state transfers, using links. Those links should, at least, contain two pieces of information: URL and relationship. The relationship tells the client the meaning of the state transition, allowing to recognize what it will do. The URL only says where to locate the service.

Altri suggerimenti

Typically, a REST web service should be ignorant of client state. It should only provide the ability to retrieve and update data based on a specific url (you may want to read up on REST). If you are following these guidelines, then the UI should drive any logic regarding the state of a workflow or record.

The hypertext returned provides the next "possible" transitions in the form of 'links' to the "resources". The client/user selects the next transition.

REST APIs must be hypertext-driven may be a good read!

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top