As a web developer, you are going to spend a decent amount of your time building and update API endpoints.
If you are using Django, I recommend using Django’s excellent Django Rest Framework.
There are three places you can add valiation
Adding Validation at DRF/Django View-Level
An easy place to add valiation is directly in the view.
Adding at DRF Serializer-Level
DRF serializers provide their own validation mechanism.
Adding at Django Form-Level
Django forms, and specifically Django model forms are an decent place to add valiation.
And then in your view: