How to test Django REST API using postman?

You can use Basic Auth in POSTMAN. Refer to this screenshot:

enter image description here

You could change the HTTP Methods, URLs, Data Payload(under Body tab) etc in the POSTMAN console

UPDATE-1

After your comments, I tried to recreated the problem.What I did was:

  1. created a view

    from rest_framework.views import APIView
    from rest_framework.permissions import IsAuthenticated
    from rest_framework.response import Response
    
    class MySampleView(APIView):
        permission_classes = (IsAuthenticated,)
    
    def get(self, request):
        return Response(data={"status": True})
    
  2. Added to urls.py

    urlpatterns = [
                  url(r'^mysampleview/$', MySampleView.as_view())
                  ]
    

And my POSTMAN response are below:

Authorization Screenshot

Header Screenshot

My conclusion

You may enter wrong credentials, or something else. I would suggest you open a new POSTMAN tab and repeat the procedure, also try to login Django admin using the same credential which is already used in POSTMAN


If you want to use Basic Authentification to test Django REST API, it must be allowed in Django REST Framework settings:

'DEFAULT_AUTHENTICATION_CLASSES': [
        'rest_framework.authentication.BasicAuthentication',
...