* See the License for the specific language governing permissions and * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * distributed under the License is distributed on an "AS IS" BASIS, * Unless required by applicable law or agreed to in writing, software * You may obtain a copy of the License at * you may not use this file except in compliance with the License. * Licensed under the Apache License, Version 2.0 (the "License") This is my client side of code: /* Sockets Example When I consume the API with python, it works very easily with this chunk of code (I get the JSON data as I need) import requestsīut from client side all I am getting in GET request are the HTTP response headers. Return Response(status=status.HTTP_204_NO_CONTENT) ![]() Return Response(serializer.errors, status=status.HTTP_400_BAD_REQUEST) Return Response(status=status.HTTP_404_NOT_FOUND) Return Response(serializer.data, 'PUT', 'DELETE'])ĭef song_detail(request, id, format=None): ![]() ![]() Serializer = SongSerializer(data=request.data) Serializer = SongSerializer(songs, many=True) models import Songįrom rest_corators import api_viewįrom rest_framework.response import Response From the server side, I am using Django with Django REST Framework and I configured the code to handle requests as shown below: from. I am trying to make a client-server app and I am trying to send data through REST API from my server to my client.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |