Creating multiple resources in a single request

Hi,

I have 100 objects that needed to created. How do we handle this with json:api? I can loop each object and do a POST request but I think that’s too much.

Please let me know if you have an idea.

Thank you.

If the server you’re interacting with supports the JSON:API 1.1 “Atomic Operations” extension, you could pack all that into a single request, but I don’t know how widely implemented that is.

Not sure what makes 100 requests too much, though, especially if you want 100 things done.

-Fred

1 Like

@fdrake and @paolooo this looks like it’s also available in v1.0 (if looking Extensions link off of the 1.0 specification).

The implementation may be specific, i.e., if adding the 100 resources takes a long time, longer than say a typical AWS Lambda function may run, e.g., 15 minutes, one can leverage a Step Function that processes half of the resources, then begins another instance of the Lambda for the next set to process, serially or in parallel.

The only limitation I would see would be a server processing limitation. A Spring Boot API, or other implementation, might not have a runtime limitation, as an AWS Lambda might.

If you’re looking at this page, as I suspect:
https://jsonapi.org/extensions/
It’s worth noting the highlight box at the top, indicating that this describes a feature of a future version of the specification. This is not part of JSON:API 1.0.

There’s no reason to believe that any specific service has implemented this feature unless that service specifically indicates availability in it’s documentation.

-Fred

I was looking at your original link and didn’t follow it to the root you posted. Good call out.