Closed
Description
Hi there.
I have API endpoint which receives list of items. I need an array of items as input
@action(detail=False, methods=['post'])
def some_action(self, request, pk=None):
serializer = PersonSerializer(data=request.data, many=True)
But when I try to post data in such way:
{
"data": [
{
"type": "person",
"id": "508",
"attributes": {
"name": "test1"
}
},
{
"type": "person",
"id": "431",
"attributes": {
"name": "test2"
}
}
]
}
I always get this error:
{
"errors": [
{
"detail": "Received data is not a valid JSONAPI Resource Identifier Object",
"status": "400",
"source": {
"pointer": "/data"
},
"code": "parse_error"
}
]
}
How could I pass this error?
Is it possible to send an array of data?
Metadata
Metadata
Assignees
Labels
No labels