-
Notifications
You must be signed in to change notification settings - Fork 17
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Create an endpoint to get next choice option #16
Comments
Hi @marciojunior88 ! |
no, I understood that it was to set up an endpoint that would be used to call the function of returning a list. Is not it? |
Yes, that's it. Check this line docs in description:
This is a request example. So, you will receive this data in query param and in the body. Currently, we don't have the function that will calculate what is the next option but that's not a problem now and you don't have to implement that. So, what you will do is to create the endpoint, parse the query params and the body into a struct and |
am I supposed to write an endpoint in this complete format above? I was thinking it was to write only the url of the endpoint as I did above |
Ah, now I understood your doubt....! 🤓 Yes, you should write in this complete format to preserve the semantic in the URL because this endpoint will not only list average options, it will return the next |
$ curl -X POST http://stop-analyzing/api/list-option?count=3 --header 'Content-Type: application/json' -d '{ "previousChoices": ["1","2","3"] }' it is? |
Actually, not. Please, check my comment above: #16 (comment) |
sorry, what's wrong? |
The URL path will be |
anything else you can contribute? |
Nope, I think the only thing I had to point was the URL path. If you have any doubt about the requirements or the code, please feel free to ask! =) |
Entendido ! |
just passing to say that this is not restful, although it ain't a problem if you don't want it to be 😄 |
Yes, It would be good to have it RESTful, but that's not a problem not to have. For example, changing this from POST to GET (as we are retrieving the next option) would make sense, but technically it would be a problem because we need to pass an array as request param and doing that is really weird. Another thing to point here is that this is not a fully transactional endpoint to the client's perspective, as he will almost have just this one endpoint to invoke. The transactional part will live in another endpoints that makes a lot of sense being RESTful (create product, retrieve product, filter product by attribute...), but they will be used in another client context, in an administration perspective. But if you have a suggestion on how to make this endpoint RESTful it would be nice to hear you. As this issue is not done yet, there's space to change here. |
GET /choice?previous=x&previous=y This is how I would do it But it boils down to personal preferences :P |
@GreenStage I was thinking about your RESTful suggestion and I think it is better than the POST approach I suggested. Let's go for it and change the Spec to use it. @marciojunior88, I just updated the spec in the first comment of this thread #16 (comment). please follow the new Spec for this endpoint. Quick tip: GET /choice?previous=<previous_choice_0_id>&previous=<previous_choice_1_id>&count=<how_many_returning_choices>
Example:
Thanks @GreenStage ! |
Hi @marciojunior88 ! Thanks! |
I could tackle this issue! |
Awesome, @dianalin2 ! 🚀 If you need some help, just ask and we will come to you. Pingback: bancodobrasil/stop-analyzing-embed#70 |
Hi, @tiagostutz, just for clarification, I am just writing the routing path, correct? I'm not returning anything? |
Hi @dianalin2 ! Yep.! You could return this fixed payload, just to have something returned:
Then, in another issue we will tackle the selecting items logic. |
Hi @dianalin2 |
Implement only the Route, you don't have to implement yet the algorithm of sorting items and actually retrieve them, just the endpoint retrieving a fixed array of items. We will create another issue for that algorithm.
Spec:
Wedding dress Stop Analyzing Database
Using th API
...
Get Choice Option
To get the next choices to be presented to the user, the client will invoke an endpoint passing and array with the previous choices and how many items it wants to be retrieved and the algorithm will compute an ordered list of items based on the features (tags) of those previously chosen items returning the
n
items requested and the completion ratio of the choice session (we will discuss this in another issue).This approach will have scale issues on large databases, but we won't address this issues now as we don't have any large database scenario on sight.
GET /choice
query params:
previous
: an array of previously selected choices used to filter the next choices. Default: emptycount
: a number of how many items to return. Default:2
Examples:
Return:
The text was updated successfully, but these errors were encountered: