Ran-oops / DRF_Project3

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

improvements:

return Response(serializer.errors, status=status.HTTP_400_BAD_REQUEST)
The @api_view decorator for working with function based views.
The APIView class for working with class-based views.
return Response(data)

serializer = SnippetSerializer(snippets, many=True)
return Response(serializer.data)

http http://127.0.0.1:8000/snippets/ Accept:application/json  # Request JSON
http http://127.0.0.1:8000/snippets/ Accept:text/html         # Request HTML

http --form POST http://127.0.0.1:8000/snippets/ code="print(123)"
http --json POST http://127.0.0.1:8000/snippets/ code="print(456)"

About


Languages

Language:Python 100.0%