Regarding creating resources, the spec notes:
If a relationship is provided in the relationships member of the resource object, its value MUST be a relationship object with a data member. The value of this key represents the linkage the new resource is to have.
Regarding inclusion, the spec notes:
Note: This section applies to any endpoint that responds with primary data, regardless of the request type. For instance, a server could support the inclusion of related resources along with a POST request to create a resource or relationship.
When I’m creating a new resource and want to created a related resource in the same request, I have to figure out how to link them together. Both resources will not have an ID yet.
So, how should I solve this?
Our system is not designed to persist client-generated IDs. We could adjust it so it would allow them through the API, but would replace them with system-generated IDs. I was not able to tell if this would be in line with the spec.