Closed yaronchristiaens closed 2 years ago
The apis have been reset.
Given this has happened in the past, I think it's good to bring this up as a teachable moment. You cannot rely on data coming from any api as always 100% correct every time. This project, thay is for students, has the ability to change often, and or production code that is being itterated on. Always add some defensive code to ensure what you are getting is what you expect.
My suggestions are
The first option is a good quick fix and might be the solution you need for right now.
The second option is more a realistic example of code you will write professionally. My recommendation is to take some time and write defensive code. Sanitize the data coming from the api and filter out the bad apples before displaying the ui.
Thanks for the help @jermbo , I've implemented an Iterator that removes the coffees that have an ID greater than 20. The second option you suggested works perfect.
@yaronchristiaens I'm curious what the error was. Regardless you should try to give us more information. That way if there is something that is required other than resetting it then we can also look into it. Or talk about a "constant" version.
Remember also that the endpoints can be edited by you.
The API of coffees is again filled with wrong data, which is stressful because in a few days I need to hand in my Android Studio project.