How to create object together with related object in same POST method using Flask-rest-jsonapi / JSON API?

893 Views Asked by At

I have a scenario where i would like to create one new parent object with new child object using FLASK-REST-JSON API package . e.g

Scenario like to create a new Person with new computer in one POST method itself.

As per official documentation , we can create new person and new computer using separate POST and then link them together using relationships.However i would like to create both objects together in same POST method.

Please let me know is it possible ? If yes,any example would be great .

Thanks !

1

There are 1 best solutions below

6
jelhan On BEST ANSWER

Creating multiple resources with one request is not supported by JSON:API spec v1. There are some discussions to add support for such as an extension in upcoming v1.1: Introduce Atomic Operations extensions. There was an old extension called Bulk extension some time ago but that was experimental and the design of extensions has changed a lot by then.

I don't think any of these proposals / experiments have been implemented in Flask-REST-JSONAPI.