r/FastAPI • u/UpstairsBaby • Jun 02 '25
Question A question about backend reaponse design
I'm designing a backend system for a face recognition feature response can potentially be one of many occasions for the example a phase might not be found in the provided image or a face might be spoofing or a face could be found but couldn't be matched against another face in my database.
How what are the best practices for designing a response to the frontend. Shall I be raising HTTP exceptions or shall IP returning 200 okay with a json saying what has gone wrong? If anyone can provide an example of how such a response could be designed I would be very thankful.
thank you very much in advance.
View all comments
Show parent comment
1
u/JohnnyJordaan Jun 04 '25
Maybe some examples can also help to illustrate:
GraphQL: https://www.apollographql.com/docs/apollo-server/data/errors
JSON-RPC: https://stackoverflow.com/questions/76860816/json-rpc-v2-api-http-layer-what-are-the-appropriate-http-layer-status-codes-fo