title: Django Rest Framework API POST receiving status code 200 instead 201
body: <p>I am new to Django and python. I have a website that already in production using docker. And the API URL is on: <a href="http://gmlews.com/api/data" rel="nofollow noreferrer">http://gmlews.com/api/data</a>. When I want to test the API using postman, the GET method working fine, but for the POST method is returned response 200 OK not 201 created. Because of that, my data can't be saved in the API.</p>
  
  <p>Here is my code for the API :</p>
  
  <p>restapi/serializers.py:</p>
  
  <pre><code>from .models import Data,Node
  from rest_framework import serializers
  
  
  class DataSerializer(serializers.ModelSerializer):
     class Meta:
      model = Data
      fields = '__all__'
  
  
  class NodeSerializer(serializers.ModelSerializer):
     class Meta :
      model = Node
      fields = '__all__'
  </code></pre>
  
  <p>restapi/views.py:</p>
  
  <pre><code>import json
  from django.views.generic import View
  from django.shortcuts import render
  from rest_framework import routers, serializers, viewsets
  from rest_framework.response import Response
  from restapi.serializers import DataSerializer, NodeSerializer
  from restapi.models import Data, Node
  from django_filters.rest_framework import DjangoFilterBackend
  from django.http import HttpResponse
  from rest_framework.views import APIView
  # Create your views here.
  
  
  class DataViewSet(viewsets.ModelViewSet):
      queryset = Data.objects.all()
      serializer_class = DataSerializer
      filter_backends = [DjangoFilterBackend]
      filterset_fields = ['node_id']
  
  
  class MapViewSet(viewsets.ModelViewSet):
      queryset = Data.objects.filter(node_id=1).order_by('-id')[:1]
      serializer_class = DataSerializer
  
  
  class NodeViewSet(viewsets.ModelViewSet):
      queryset = Node.objects.all()
      serializer_class = NodeSerializer
  </code></pre>
  
  <p>urls.py:</p>
  
  <pre><code>from django.contrib import admin
  from django.contrib.auth import views as auth_views
  from django.urls import include, path
  from restapi import views
  """ for routers api root"""
  from restapi.models import Data, Node
  from rest_framework import routers
  from restapi.views import DataViewSet, NodeViewSet, MapViewSet
  
  router = routers.DefaultRouter()
  
  router.register(r'data', DataViewSet, 'data')
  
  router.register(r'node', NodeViewSet, 'node')
  
  router.register(r'map', MapViewSet, 'map')
  
  
  urlpatterns = [
  path('admin/', admin.site.urls),
  path(r'api/', include(router.urls)),
  path(r'', include('rest_framework.urls', namespace='rest_framework')),
  
  ]
  </code></pre>
  
  <p>Can someone help me with this issue? I really don't have an idea why the POST method received status 200. I want it to received status 201 so my data can be saved. Thank you</p>