Closed just-Jana closed 1 year ago
So you want this by sending one request to the API? By now this is possible by sending another GET request to the /exercise
endpoint
No, you have to take the solution_exercise
and perform a GET
request at the /exercise
endpoint with this value as the exercise_id
.
The problem is, that you had to perform this GET
request for every single element of a solution list, which is highly inefficient. A better approach would be to send the data in the same format as exercise
sends it. By sending solution_exercise_value
and solution_exercise_name
no additional requests would be required.
That's why most programming languages have loops.
Anyway, there is a way to allow one argument being passed multiple times in the URL. Should look something like this exercise_id=1&exercise_id=2&exercise_id=3
. We could then query the database for all these values and return all results. You would only need one GET
request to the endpoint. Would this suit your needs?
I can try doing this, thanks for your ideas on that :)
That's why most programming languages have loops.
Anyway, there is a way to allow one argument being passed multiple times in the URL. Should look something like this
exercise_id=1&exercise_id=2&exercise_id=3
. We could then query the database for all these values and return all results. You would only need oneGET
request to the endpoint. Would this suit your needs?
Wait... have you already implemented this or offered to do this?
I have not yet implemented this feature. I can get a prototype ready till monday.
I want to display the title (and probably the type and language) of the exercise to which a solution belongs. May I get these information by the solutions GET-request?