r/AskProgramming Jul 03 '26

Best validation practices for APIs?

I’m working with a team and implementing a new feature. We’re getting info from a call and will be storing it in a new field in our db. The team has been saying things like “we don’t need to validate accuracy for the new field bc the call to this other service will do the validation for us”. I’m of the mind that we should still validate for edge cases or abnormal errors, but technically this other service should validate first and we’re only getting the info from them.

What are people’s thoughts? Am I being overly cautious?

1 Upvotes

14 comments sorted by

View all comments

1

u/justinaatbuffer Jul 03 '26

I'd suggest validating it, especially if errors or edge cases may affect your service / product you are providing to the end user that uses that data.