Search code examples
apirestdesign-patternsasp.net-core-webapihateoas

How to implement multi-step form with REST API and HATEOAS


I would like to create a REST API with using HATEOAS to create multi-step form. Each step will be a separate endpoint that offers the data to select, and in the last step, all the collected data will be stored in the database. Is there any design pattern or best practice?

Thank you for answer.


Solution

  • Generally I would take this approach:

    • Each step is its own form.
    • Each of those forms submit to a specific endpoint.
    • The server stores the intermediate steps and returns the 'next step form'. You could store this in a storage system such as Redis.
    • When the last form is submitted, take all the data from the intermediate steps and submit it.