Note: This release is in preview. Features described here don’t become generally available until the latest general availability date that Salesforce announces for this release. Before then, and where features are noted as beta, pilot, or developer preview, we can’t guarantee general availability within any particular time frame or at all. Make your purchase decisions only on the basis of generally available products and features.
Composite Graph
The composite graph resource lets you submit composite graph operations. This
resource is available in REST API version 50.0 and later.
Syntax
URI: /services/data/vXX.X/composite/graph
Formats: JSON
HTTP methods: POST
Authentication: Authorization: Bearer token
Request parameters: None
Request Body
1{
2 "graphs" : [
3 {
4 "graphId" : "graphId",
5 "compositeRequest" : [
6 compositeSubrequest,
7 compositeSubrequest,
8 ...
9 ]
10 }
11 ]
12}where each compositeSubrequest is a composite subrequest.
Response Body
1{
2 "graphs" : [
3 {
4 "graphId" : "graphId",
5 "graphResponse" : {
6 "compositeResponse" : [
7 compositeSubrequestResult,
8 compositeSubrequestResult,
9 compositeSubrequestResult,
10 ...
11 ]
12 },
13 "isSuccessful" : flag
14 },
15 ...
16 ]
17}| Name | Type | Description |
|---|---|---|
| graphs | Array of graph responses. | |
| graphId | String | The identifier of the graph. |
| graphResponse | Object | The response of the request. |
| compositeResponse | Array of composite subrequest results. | Results for each node in the graph. |
| isSuccessful | Boolean | Whether this graph was processed successfully (true) or not (false). |
Example
Example Request
1curl -X POST https://MyDomainName.my.salesforce.com/services/data/v67.0/composite/graph -H "Authorization: Bearer token" -H "Content-Type: application/json" -d "@graphRequestBody.json"Example Request Body
1{
2 "graphs" : [
3 {
4 "graphId" : "1",
5 "compositeRequest" : [
6 {
7 "url" : "/services/data/v67.0/sobjects/Account/",
8 "body" : {
9 "name" : "Cloudy Consulting"
10 },
11 "method" : "POST",
12 "referenceId" : "reference_id_account_1"
13 },
14 {
15 "url" : "/services/data/v67.0/sobjects/Contact/",
16 "body" : {
17 "FirstName" : "Nellie",
18 "LastName" : "Cashman",
19 "AccountId" : "@{reference_id_account_1.id}"
20 },
21 "method" : "POST",
22 "referenceId" : "reference_id_contact_1"
23 },
24 {
25 "url" : "/services/data/v67.0/sobjects/Opportunity/",
26 "body" : {
27 "CloseDate" : "2024-05-22",
28 "StageName" : "Prospecting",
29 "Name" : "Opportunity 1",
30 "AccountId" : "@{reference_id_account_1.id}"
31 },
32 "method" : "POST",
33 "referenceId" : "reference_id_opportunity_1"
34 }
35 ]
36 },
37 {
38 "graphId" : "2",
39 "compositeRequest" : [
40 {
41 "url" : "/services/data/v67.0/sobjects/Account/",
42 "body" : {
43 "name" : "Easy Spaces"
44 },
45 "method" : "POST",
46 "referenceId" : "reference_id_account_2"
47 },
48 {
49 "url" : "/services/data/v67.0/sobjects/Contact/",
50 "body" : {
51 "FirstName" : "Charlie",
52 "LastName" : "Dawson",
53 "AccountId" : "@{reference_id_account_2.id}"
54 },
55 "method" : "POST",
56 "referenceId" : "reference_id_contact_2"
57 }
58 ]
59 }
60 ]
61}Example Response Body
1{
2 "graphs" : [
3 {
4 "graphId" : "1",
5 "graphResponse" : {
6 "compositeResponse" : [
7 {
8 "body" : {
9 "id" : "001R00000064wc7IAA",
10 "success" : true,
11 "errors" : [ ]
12 },
13 "httpHeaders" : {
14 "Location" : "/services/data/v67.0/sobjects/Account/001R00000064wc7IAA"
15 },
16 "httpStatusCode" : 201,
17 "referenceId" : "reference_id_account_1"
18 },
19 {
20 "body" : {
21 "id" : "003R000000DDMlTIAX",
22 "success" : true,
23 "errors" : [ ]
24 },
25 "httpHeaders" : {
26 "Location" : "/services/data/v67.0/sobjects/Contact/003R000000DDMlTIAX"
27 },
28 "httpStatusCode" : 201,
29 "referenceId" : "reference_id_contact_1"
30 },
31 {
32 "body" : {
33 "id" : "006R0000003FPYxIAO",
34 "success" : true,
35 "errors" : [ ]
36 },
37 "httpHeaders" : {
38 "Location" : "/services/data/v67.0/sobjects/Opportunity/006R0000003FPYxIAO"
39 },
40 "httpStatusCode" : 201,
41 "referenceId" : "reference_id_opportunity_1"
42 }
43 ]
44 },
45 "isSuccessful" : true
46 },
47 {
48 "graphId" : "2",
49 "graphResponse" : {
50 "compositeResponse" : [
51 {
52 "body" : {
53 "id" : "001R00000064wc8IAA",
54 "success" : true,
55 "errors" : [ ]
56 },
57 "httpHeaders" : {
58 "Location" : "/services/data/v67.0/sobjects/Account/001R00000064wc8IAA"
59 },
60 "httpStatusCode" : 201,
61 "referenceId" : "reference_id_account_2"
62 },
63 {
64 "body" : {
65 "id" : "003R000000DDMlUIAX",
66 "success" : true,
67 "errors" : [ ]
68 },
69 "httpHeaders" : {
70 "Location" : "/services/data/v67.0/sobjects/Contact/003R000000DDMlUIAX"
71 },
72 "httpStatusCode" : 201,
73 "referenceId" : "reference_id_contact_2"
74 }
75 ]
76 },
77 "isSuccessful" : true
78 }
79 ]
80}