Tag Info

Hot answers tagged

1

I would use option Change the API so every request for an image returns the image + a status information. If there is no image, you return a 0 byte stream for the image and a status like "no image available". So the user of the API needs only one roundtrip to retrieve the full information, the operation is atomic, you don't return an error for a valid ...


1

I would prefer option 1. This would involve expanding your current definition of an Incident to contain a hasImage flag so that the client can decide for which Incidents to call the image fetching API (eg, getIncidentImage(...)) Thos covers modelling and API design. As other people have mentioned, from a UX perspective, you might want to include a ...


1

It depends on the technology you use. Normally in this case you would return a Type that describes the possibility of an image. In some languages these types are built in (Option in Scala, Maybe in Haskell). In other ones you can write them yourselves or use a library that includes these types. For javascript (which may be what you can use, I guess), you can ...



Only top voted, non community-wiki answers of a minimum length are eligible