Hey, it really depends on how you implement your endpoints. We personally, use RPC most of the time so, the implementation of the views might look like this:

def deposit(request):
asof = timezone.now()
amount = int(request.data['amount'])
except (KeyError, ValueError):
return Response({
'error': 'invalid_request',
'data': {
'amount': 'missing or invalid number.'
account, action = account.deposit(
except ExceedsLimit:
return Response({'error': 'exceeds_limit.', 'data': None})
except InvalidAmount:
return Response({'error': 'invalid_amount.', 'data': {'amount': amount}})
except Account.DoesNotExist:
return Response({'error': 'invalid_request.', 'data': {'account': 'does not exist'}})
return Response({
# ... whatever...

Full Stack Developer, Team Leader, Independent. More from me at https://hakibenita.com

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store