Newer Version Available
Bulk API 2.0 Usage
Using Bulk API 2.0, you can query the MetadataComponentDependency Tooling API object and
retrieve up to 100,000 records in a single query. Use SOQL queries to list the relationships
between the metadata components in
your
org.
Bulk API 2.0 requests are returned in CSV format.
You can use the WHERE clause to filter your query.
1{
2"operation": "query",
3"query": "select RefMetadataComponentName, RefMetadataComponentType, RefMetadataComponentId
4 FROM MetadataComponentDependency
5 WHERE RefMetadataComponentId = '01p0U000001ONbgQAG'"
6}Create a Bulk API 2.0 Query Job
| Description | URI | HTTP Method |
|---|---|---|
| Creates a query job. | /services/data/vXX.X/tooling/jobs/query | POST |
This example creates a job that queries the Tooling API object MetadataComponentDependency.
1curl --include --request POST \
2--header "Authorization: OAuth token " \
3--header "Accept: application/json " \
4--header "Content-Type: application/json" \
5--data '{
6 "operation": "query",
7 "query": "select MetadataComponentType FROM MetadataComponentDependency“
8}' \
9"https://instance.salesforce.com/services/data/v49.0/tooling/jobs/query"The response is:
1HTTP/1.1 200 OK
2{
3 "id" : "750R0000000$H8AAU",
4 "operation" : "query",
5 "object" : "MetadataComponentDependency",
6 "createdById" : "005xx000001X9JAAS",
7 "createdDate" : "2020-04-09T17:51:02.000+0000",
8 "systemModstamp" : "2020-04-09T17:51:02.000+0000",
9 "state" : "UploadComplete",
10 "concurrencyMode" : "Parallel",
11 "contentType" : "CSV",
12 "apiVersion" : 49.0,
13 "lineEnding" : "LF",
14 "columnDelimiter" : "COMMA"
15}Get Information About a Query Job
| Description | URI | HTTP Method |
|---|---|---|
| Gets information about all query jobs in the org. | /services/data/vXX.X/tooling/jobs/query | GET |
| Gets information about one query job. | /services/data/vXX.X/tooling/jobs/query/queryJobId | GET |
| Gets the results for a query job. | /services/data/vXX.X/tooling/jobs/query/queryJobId/results | GET |
This example gets information about the job with ID 750R0000000$H8AAU.
1curl --include --request GET \
2--header "Authorization: OAuth token" \
3"https://instance.salesforce.com/services/data/v49.0/tooling/jobs/query/750R0000000$H8AAU"The response is:
1{
2 "id" : "750R0000000$H8AAU",
3 "operation" : "query",
4 "object" : "MetadataComponentDependency",
5 "createdById" : "005xx000001X9JAAS",
6 "createdDate" : "2020-04-09T17:51:02.000+0000",
7 "systemModstamp" : "2020-04-09T17:51:02.000+0000",
8 "state" : "JobComplete",
9 "concurrencyMode" : "Parallel",
10 "contentType" : "CSV",
11 "apiVersion" : 49.0,
12 "jobType" : "V2Query",
13 "lineEnding" : "LF",
14 "columnDelimiter" : "COMMA",
15 "numberRecordsProcessed" : 145,
16 "retries" : 0,
17 "totalProcessingTime" : 272}Abort or Delete a Query Job
| Description | URI | HTTP Method |
|---|---|---|
| Aborts a query job. | /services/data/vXX.X/tooling/jobs/query/queryJobId | PATCH |
| Deletes a query job. | /services/data/vXX.X/tooling/jobs/query/queryJobId | DELETE |
This example aborts the job with ID 750R0000000$H8AAU:
1curl --request PATCH \
2--header "Authorization: OAuth token" \
3--header "Content-Type: application/json" \
4--data '{
5 "state": "Aborted"
6}' \
7"https://instance.salesforce.com/services/data/v49.0/tooling/jobs/query/750R0000000$H8AAU"The response is:
1{
2 "id": "750R0000000$H8AAU",
3 "operation": "query",
4 "object": "MetadataComponentDependency",
5 "createdById" : "005xx000001X9JAAS",
6 "createdDate" : "2020-04-09T17:51:02.000+0000",
7 "systemModstamp" : "2020-04-09T17:51:02.000+0000",
8 "state": "Aborted",
9 "concurrencyMode": "Parallel",
10 "contentType": "CSV",
11 "apiVersion": 49.0
12}Additional Information
For more information, see Bulk API 2.0.