Additional request inclusion behaviors
PATCHing and POSTing in a single request
When you execute a POST with request inclusion, the operation for each included resource must also be POST.
When you execute a PATCH with request inclusion, the operation for an included resource could be either POST or PATCH.
- If you want to modify an existing resource and create a new related resource, the included resource's operation is POST.
- If you want to modify an existing resource and modify an existing related resource, the included resource's operation is PATCH.
Requests succeed or fail as a unit
When a POST or PATCH uses request inclusion, it is possible that there could be a failure either of the operation on the root resource or the operation on any of the included resources. If any operation fails, the entire request fails and none of the objects are POSTed or PATCHed.
Included resources cannot reference resources other than the root resource
When using request inclusion, each included resource must specify its own operation and
uri. The uri is expected to reference the root resource using the keyword
this. This ensures that when the included resource is POSTed or PATCHed,
the included resource is related to the root resource.
For example, suppose a POST is creating an account and an AccountContact. The
uri for the Accountcontact would have a value such as
From a syntax perspective, you could attempt to attach an included resource
not to the root resource, but rather to some other existing resource. For example, instead
of referencing the root resource, the uri for the AccountContact could reference an existing
account, such as "
/account/v1/accounts/pc:20/contacts". This uri says
"create an AccountContact and attach it not to the root resource of this POST, but rather to
the existing account pc:20".
The system APIs will not allow this. Any attempt to POST or PATCH an included resource to something other than the root resource will cause the operation to fail.