Closed ProteanCode closed 3 years ago
This is not supported by the JSON:API spec 1.0 - it is looking like it will be added in 1.1, but that's been the case for a while and I'm not sure when that new version will be released.
My tip would be for the moment set up your own non-JSON:API endpoint for handling this. I.e. have a route that expects application/json
and can have any structure that you want. It can of course return a JSON:API resource if that is desired. That's how I've implemented this use case as an interim solution until it gets added to the spec.
This is not supported by the JSON:API spec 1.0 - it is looking like it will be added in 1.1, but that's been the case for a while and I'm not sure when that new version will be released.
My tip would be for the moment set up your own non-JSON:API endpoint for handling this. I.e. have a route that expects
application/json
and can have any structure that you want. It can of course return a JSON:API resource if that is desired. That's how I've implemented this use case as an interim solution until it gets added to the spec.
Or I should make that two requests to store role first and assign the translation later. I guess I will do that this way even if it is not the greatest one, it still follows the pattern
Hi there.
Simply put I have to create a multilingual API so that my Role model may have multiple RoleTranslation models attached to it.
I have tried to make it by sending this request expecting that without sending ID a resource would be created and attached, but it failed with 400 error code
My POST request body
And I got the response
I understand what response says, but I wish I could avoid that since rolling back multiple requests and a distributed database transaction is a complex thing in most of cases.
My expectation was to create a Role resource first, then create a RoleTranslation resource and attach it to the Role.
Is this possible without making multiple requests?
Sidenote: ids are database generated uuids, but storing single resources works anyway so its not the case I guess