[LRUG] API for complex conditional data

Murray Steele murray.steele at gmail.com
Thu Oct 8 06:20:01 PDT 2020

I think my choice would depend on the behaviour of the current UI and the
data it stores.

If the current UI persists the partial data into your backend, and you
actively use and care about that partial data, then I'd want to mimic that
in the API - allow for partial submits that are written to the backend so
you have parity.  I guess it also depends what the stages of the wizard
are, do you want to mimic those exact stages, or just have a POST to
create, PATCH to update with any possible attributes and some other
endpoint to finalize and submit?

If the current UI doesn't store partial data in your backend, or if it does
but it's just an implementation detail and you don't care about it, I'd go
with the POST only API that requires complete data.  A client of the API
can then decide to implement a wizard style UI with partial submits itself
using its own store.

It comes down to the restrictions you want to set on the clients of the API
- a single submit everything API gives them the most freedom I think, but
at the cost to you of loss of insight into the partial data.

On Thu, 8 Oct 2020 at 11:04, Andrew Premdas <apremdas at gmail.com> wrote:

> Hey there,
> We have an application which has a wizard for doing a fairly complex task
> (imagine something like a tax form with lots of conditional sections). We
> want to create an api to do the same task. We have two approaches under
> consideration at the moment
> 1) Mimic the wizard via a POST and a series of PATCH calls
> 2) Flatten the wizard into a single POST call
> The first approach would require around 6 calls to complete the task
> The second call would have to fill in 50-60 pieces of data with alot of
> different validations and errors. Errors like "You cannot fill in field b
> if you have filled in field a"
> My questions for the group?
> Which choice would you make?
> Are there alternative approaches to consider
> Thanks for any input/help
> All best
> Andrew
> --
> ------------------------
> Andrew Premdas
> blog.andrew.premdas.org
> _______________________________________________
> Chat mailing list
> Chat at lists.lrug.org
> Archives: http://lists.lrug.org/pipermail/chat-lrug.org
> Manage your subscription: http://lists.lrug.org/options.cgi/chat-lrug.org
> List info: http://lists.lrug.org/listinfo.cgi/chat-lrug.org
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lrug.org/pipermail/chat-lrug.org/attachments/20201008/6bf18f93/attachment.html>

More information about the Chat mailing list