この文章は Salesforce 機械翻訳システムを使用して翻訳されました。詳細はこちらをご参照ください。
英語に切り替える

Composite Graph リファレンス

Composite Graph リソースにより、Composite Graph 操作を送信できます。

構文

URI
/services/data/vXX.X/composite/graph
適用開始バージョン
このリソースは API バージョン 50.0 以降で使用できます。
形式
JSON
HTTP のメソッド
POST
認証
Authorization: Bearer token
要求のパラメータ
なし

リクエストボディ

1{
2    "graphId" : "graphId",
3    "compositeRequest" : [
4        compositeSubrequest,
5        compositeSubrequest,
6        ...
7    ]
8}

ここで、それぞれの compositeSubrequestComposite サブ要求です。

1{
2    "graphs" : [
3        {
4            "graphId" : "1",
5            "compositeRequest" : [
6                {
7                    "url" : "/services/data/v54.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/v54.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/v54.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/v54.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/v54.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}

レスポンスボディ

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}
名前 説明
graphs グラフ応答の配列。
graphId String グラフの識別子。
graphResponse Object 要求の応答。
compositeResponse Composite サブ要求の結果の配列。 グラフの各ノードの結果。
isSuccessful Boolean このグラフが正常に処理されたか (true)、否か (false)。

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/v54.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/v54.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/v54.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/v54.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/v54.0/sobjects/Contact/003R000000DDMlUIAX"
71                  },
72                  "httpStatusCode" : 201,
73                  "referenceId" : "reference_id_contact_2"
74               }
75            ]
76         },
77         "isSuccessful" : true
78      }
79   ]
80}

要求のレスポンスボディと HTTP 状況は、1 つのレスポンスボディで返されます。要求全体が API の制限に単一のコールとして計上されます。

メモ