Should Id be mandatory in relationships and included nodes for the POST request?

I’ve checked the JSON API document for creating resources. But I found that Id is required in the POST request as well for relationships which should not be.

for example, there are two entities, “company” and “company_address”. One company has one company_address, and company_address can’t exist without a related company.
How can I create a new company with a new company_address in a single POST request?

I’ve also tried a ruby library josnapi_parameters for deserializing the request parameters, but if I do not pass the id in the relationship for nested attributes it is not forming the request params correctly.

I couldn’t find any solution for that. I would highly appreciate some feedback.

Thank you!

1 Like