Skip to content

Bulk operations without extensions #1625

@ben221199

Description

@ben221199

At the moment, for server-to-client documents (GET) the JSONAPI content could be:

  • {"data":null} (no resource)
  • {"data":{}} (one resource)
  • {"data":[]} (multiple resources)

However, for client-to-server documents (POST, etc.) the JSON content seems to be only be:

  • {"data":{}} (one resource)

Section 7.1 tells:

The request MUST include a single resource object as primary data.


However, I would suggest to add support for bulk creation/updating/deletion for the SAME type without using the Atom Operations extension. For this feature the JSONAPI document format does NOT have to change, because [] is already supported by the document parser, but only NOT added as possible value for POST requests. In this case, bulk would be possible using one request. (Eventually {"data":null} could be supported too for POST requests if for some reason.)

If there will be no errors during bulk, the server could respond with normal status code. If there will be errors, the server could choose to let all resources fail and show the errors or add the valid ones and show errors for the failing ones. In the last case, it maybe should be allowed to use data next to errors. (Maybe introduce a new errors attribute to tell what the server did; maybe: {"partly":true}. (This could also be a meta thing, so that it is up to the client to handle the partly failing operation.)

I also think this suggestion is compatible with previous versions because of the never remove, only add strategy. As already told, all JSONAPI parsers already support this format.

Metadata

Metadata

Assignees

No one assigned

    Labels

    extensionRelated to existing and proposed extensions as well as extensions in general

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      pFad - Phonifier reborn

      Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

      Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


      Alternative Proxies:

      Alternative Proxy

      pFad Proxy

      pFad v3 Proxy

      pFad v4 Proxy