Composite Subrequest
Properties
Name | Type | Description |
---|---|---|
body | Varies |
Optional. The input body for the subrequest. The contents depend on the request specified in the url property. Referenceable types are DateTime, String, Boolean, Byte, Character, Short, Integer, Long, Double, and Float. |
method | String |
Required. The method to use with the requested resource. Possible values are DELETE, GET, PATCH, and POST (case-sensitive). For a list of valid methods, refer to the documentation for the requested resource. This method is distinct from the POST method that is used to submit the composite graph request. The method specified here is the one that operates (within the graph) on the resource specified in the url.
|
referenceId | String |
Required. Reference ID that maps to the subrequest’s response and can be used to reference the response in later subrequests. You can reference the referenceId in either the body or URL of a subrequest. Use this syntax to include a reference: @{referenceId.FieldName}. You can use two operators with the reference ID. The . operator references a field on a JSON object in the response. For example, say you retrieve an account record’s data in one subrequest and assign the reference ID Account1Data to the output. You can refer to the account’s name in later subrequests like this: @{Account1Data.Name}. The [] operator indexes a JSON collection in the response. For example, say you request basic account information with the sObject Basic Information resource in one subrequest and assign the reference ID AccountInfo to the output. Part of the response includes a collection of recently created accounts. You can refer to the ID of the first account in the recent items collection like this: @{AccountInfo.recentItems[0].Id}. You can use each operator recursively as long as it makes sense in the context of the response. For example, to refer to the billing city component of an account’s compound address field: @{NewAccount.BillingAddress.city}. referenceId is case-sensitive, so pay close attention to the case of the fields you’re referring to. See Usage.
|
url | String |
Required. The resource to request.
|
Examples
Example 1
{
"body" : {
"Name" : "Sample Account"
},
"method" : "POST",
"referenceId" : "refAccount",
"url" : "/services/data/v63.0/sobjects/Account"
}
Example 2
{
"method" : "GET",
"referenceId" : "NewAccountFields",
"url" : "/services/data/v63.0/sobjects/Account/@{refAccount.id}"
}
Usage
Because referenceId is case-sensitive, it’s important to note the case of the fields that you’re referring to. The same field can use different cases in different contexts. For example, when you create a record, the ID field appears as id in the response. But when you access a record’s data with the sObject Rows resource, the ID field appears as Id. In the Example 2, the @{refAccount.id} reference is valid because refAccount refers to the response from a POST like that shown in Example 1. If you use Id instead (mixed case rather than all lowercase), as in @{refAccount.Id}, you get an error when sending the request because the reference ID uses the wrong case.
When processing a composite graph request, if the number of graph failures exceeds the maximum limit of 14, processing is halted for the remaining graphs in the request. The response includes errors for the failed graphs, and the status for the remaining graphs is shown as PROCESSING_HALTED. See Composite Graph Limits for the current limits.
Results
Results for subrequests are the same as that for other Composite requests. See Composite Subrequest Result.