<div dir="ltr"><div>Thanks for the replies and input. I'll try and answer questions below<br></div><div><br></div><div>The current UI persists for each step in the wizard. The overall process has its own underlying model and each step of the wizard has its own model which is a sub class of the underlying model and has step specific validation, controller and views. With the post patch patch... approach we can reuse these sub classed models creating simple serializers for each one.</div><div><br></div><div>I"d expect most clients to use this api by assembling a big chunk of data from existing systems and using that data to drive the process. I doubt any of our clients will write their own UI to interact with our API.</div><div><br></div><div>The initial version of the API will be a simplified restricted form of the wizard. Subsequent versions of the API will add additional capability. The design of the wizard itself is unlikely to change much.</div><div><br></div><div>Each wizard step that asks a question deals with one question at time so the problem of having to deal with multiple responses isn't really there.</div><div><br></div><div>Thanks again for your input. Any additional input will be most appreciated</div><div><br></div><div>All best</div><div><br></div><div>Andrew<br></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Thu, 8 Oct 2020 at 15:22, Edwin Wills <<a href="mailto:edwin@rentify.com">edwin@rentify.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr">An interesting question! I think before I decided on a solution, I'd like to understand:<div><br></div><div>1) Is the wizard likely to change in any meaningful way in the short-mid term - if yes, then I'd try to build something generic, maybe a "questions" API that takes attributes to store key/values against specific questions. If not, I'd make the API structure match the front end.</div><div><br></div><div>2) How many questions does the wizard show at a time (or is it 1 question per step?). If just one question per step, this simplifies the scope a bit, as you only ever have to handle one response at a time, and it's easier to build something generic. If it's multiple, then I'd refer to my first question.</div><div><br></div><div>I've built similar APIs using both methods before, and they both have their positives and negatives, but ultimately I found that reducing the scope to one question submitted/validated at a time, and making the API generic really helped to simplify the scope (but I understand you might not have the luxury to dictate that!).</div><div><br></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Thu, Oct 8, 2020 at 2:20 PM Murray Steele <<a href="mailto:murray.steele@gmail.com" target="_blank">murray.steele@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr">I think my choice would depend on the behaviour of the current UI and the data it stores.<div><br></div><div>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? </div><div><br></div><div>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.</div><div><br></div><div>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.</div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Thu, 8 Oct 2020 at 11:04, Andrew Premdas <<a href="mailto:apremdas@gmail.com" target="_blank">apremdas@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div>Hey there,</div><div><br></div><div>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</div><div><br></div><div>1) Mimic the wizard via a POST and a series of PATCH calls</div><div>2) Flatten the wizard into a single POST call</div><div><br></div><div>The first approach would require around 6 calls to complete the task</div><div><br></div><div>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" <br></div><div><br></div><div>My questions for the group?</div><div><br></div><div>Which choice would you make?</div><div>Are there alternative approaches to consider</div><div><br></div><div>Thanks for any input/help</div><div><br></div><div>All best</div><div><br></div><div>Andrew<br></div><div><br>-- <br><div dir="ltr"><div>------------------------</div>Andrew Premdas<div><a href="http://blog.andrew.premdas.org" target="_blank">blog.andrew.premdas.org</a></div></div></div></div>
_______________________________________________<br>
Chat mailing list<br>
<a href="mailto:Chat@lists.lrug.org" target="_blank">Chat@lists.lrug.org</a><br>
Archives: <a href="http://lists.lrug.org/pipermail/chat-lrug.org" rel="noreferrer" target="_blank">http://lists.lrug.org/pipermail/chat-lrug.org</a><br>
Manage your subscription: <a href="http://lists.lrug.org/options.cgi/chat-lrug.org" rel="noreferrer" target="_blank">http://lists.lrug.org/options.cgi/chat-lrug.org</a><br>
List info: <a href="http://lists.lrug.org/listinfo.cgi/chat-lrug.org" rel="noreferrer" target="_blank">http://lists.lrug.org/listinfo.cgi/chat-lrug.org</a><br>
</blockquote></div>
_______________________________________________<br>
Chat mailing list<br>
<a href="mailto:Chat@lists.lrug.org" target="_blank">Chat@lists.lrug.org</a><br>
Archives: <a href="http://lists.lrug.org/pipermail/chat-lrug.org" rel="noreferrer" target="_blank">http://lists.lrug.org/pipermail/chat-lrug.org</a><br>
Manage your subscription: <a href="http://lists.lrug.org/options.cgi/chat-lrug.org" rel="noreferrer" target="_blank">http://lists.lrug.org/options.cgi/chat-lrug.org</a><br>
List info: <a href="http://lists.lrug.org/listinfo.cgi/chat-lrug.org" rel="noreferrer" target="_blank">http://lists.lrug.org/listinfo.cgi/chat-lrug.org</a><br>
</blockquote></div><br clear="all"><div><br></div>-- <br><div dir="ltr"><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><span style="color:rgb(0,0,0);font-family:-webkit-standard"><p dir="ltr" style="line-height:1.38;margin-top:0pt;margin-bottom:0pt"><span style="font-size:9pt;font-family:Arial;color:rgb(136,136,136);background-color:transparent;font-weight:400;font-style:normal;text-decoration:none;vertical-align:baseline;white-space:pre-wrap">Edwin Wills</span></p><p dir="ltr" style="line-height:1.38;margin-top:0pt;margin-bottom:0pt"><span style="font-size:9pt;font-family:Arial;color:rgb(136,136,136);background-color:transparent;font-weight:400;font-style:normal;text-decoration:none;vertical-align:baseline;white-space:pre-wrap">CTO</span></p><p dir="ltr" style="line-height:1.38;margin-top:0pt;margin-bottom:0pt"><span style="font-size:9pt;font-family:Arial;color:rgb(136,136,136);background-color:transparent;font-weight:400;font-style:normal;text-decoration:none;vertical-align:baseline;white-space:pre-wrap">+44 (0)333 240 2222</span></p><p dir="ltr" style="line-height:1.38;margin-top:0pt;margin-bottom:0pt"><b style="color:rgb(0,0,0);font-family:-webkit-standard;font-style:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;text-decoration:none;font-weight:normal"><br></b></p><p dir="ltr" style="line-height:1.38;margin-top:0pt;margin-bottom:0pt"><span style="font-size:11pt;font-family:Arial;color:rgb(0,0,0);background-color:transparent;font-weight:400;font-style:normal;text-decoration:none;vertical-align:baseline;white-space:pre-wrap"><img style="border: medium none;" width="120" height="32"></span></p><p dir="ltr" style="line-height:1.38;margin-top:0pt;margin-bottom:0pt"><span style="font-size:9pt;font-family:Arial;color:rgb(136,136,136);background-color:transparent;font-weight:400;font-style:normal;text-decoration:none;vertical-align:baseline;white-space:pre-wrap">65 Leonard Street, London EC2A 4QS</span></p><p dir="ltr" style="line-height:1.38;margin-top:0pt;margin-bottom:0pt"><a href="https://www.rentify.com/" style="text-decoration:none" target="_blank"><span style="font-size:9pt;font-family:Arial;color:rgb(17,85,204);background-color:transparent;font-weight:400;font-style:normal;text-decoration:underline;vertical-align:baseline;white-space:pre-wrap">www.rentify.com</span></a></p><p dir="ltr" style="line-height:1.38;margin-top:0pt;margin-bottom:0pt"><br></p></span></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div>
_______________________________________________<br>
Chat mailing list<br>
<a href="mailto:Chat@lists.lrug.org" target="_blank">Chat@lists.lrug.org</a><br>
Archives: <a href="http://lists.lrug.org/pipermail/chat-lrug.org" rel="noreferrer" target="_blank">http://lists.lrug.org/pipermail/chat-lrug.org</a><br>
Manage your subscription: <a href="http://lists.lrug.org/options.cgi/chat-lrug.org" rel="noreferrer" target="_blank">http://lists.lrug.org/options.cgi/chat-lrug.org</a><br>
List info: <a href="http://lists.lrug.org/listinfo.cgi/chat-lrug.org" rel="noreferrer" target="_blank">http://lists.lrug.org/listinfo.cgi/chat-lrug.org</a><br>
</blockquote></div><br clear="all"><br>-- <br><div dir="ltr" class="gmail_signature"><div>------------------------</div>Andrew Premdas<div><a href="http://blog.andrew.premdas.org" target="_blank">blog.andrew.premdas.org</a></div></div>