I’m working on a medium-sized project. One of the parts has to do with account creation.
I went with a RESTful API design at first, but I’m now having second thought. Persistent data are saved in MongoDB.
So to create an user, one API request is required to the backend. After creating the account, another API call to
/units would add the newly created user to the unit. I modeled this process in two steps, the client is not amused.
My first request includes account information, which returns the user id. The second request mutates the
unit, and adds the user to the unit.
They want this to be modeled as a wizard, fill the data, click nexts, and done. So essentially, I’m faced with a two options:
- Send multiple requests in order, if client receives an error on any of the requests, roll back (manually by sending requests again...)
- Create a new route for the purpose
I am just wondering what would one do? The first one sounds horrible; but the second sounds unRRSTful. Anyone else faced this?