Newer Version Available
Use Tooling API with SOAP
Use SOAP API if you’re using a strongly typed language like Java that generates Web service client code. Tooling SOAP API is used just like the Salesforce SOAP API. For details on usage, syntax, and authentication, see the SOAP API Developer's Guide.
To access the Tooling API WSDL, from Setup, click and click Generate Tooling WSDL.
Like the Salesforce SOAP API, Tooling API uses the following calls.
| Call | Description |
|---|---|
| create() | Adds one or more records to your organization’s data. |
| delete() | Deletes one or more records from your organization’s data. |
| describeGlobal() | Lists the available Tooling API objects and their metadata. |
| describeSObjects() | Describes metadata (field list and object properties) for the specified
object or array of objects. Call describeGlobal() to retrieve a list of all Tooling API objects for your organization, then iterate through the list and use describeSObjects() to obtain metadata about individual objects. |
| executeanonymous(string apexcode) | Executes the specified block of Apex anonymously and returns the result. |
| query() | Executes a query against a Tooling API object and returns data that matches the specified criteria. |
| queryMore() | Retrieves the next batch of objects from a query(). |
| retrieve() | Retrieves one or more records based on the specified IDs. |
| runTests() and runTestsAsynchronous() | Executes test methods in the specified classes. Running tests asynchronously allows methods to process in parallel, cutting down your test run times. For example code, see ApexTestQueueItem. |
| update() | Updates one or more existing records in your organization’s data. |
| upsert() | Creates records and updates existing records; uses a custom field to determine the presence of existing records. |
Starting in API version 34.0, the following calls support the AllOrNoneHeader header: create(), update(), upsert(), and delete().
By default, if AllOrNoneHeader isn’t used, those calls can save a partial set of records for records with no errors (equivalent to AllOrNoneHeader=false). If AllOrNoneHeader is set to true, records are saved only when there are no failures in any record in the call.
Examples
These examples use Java, but you can use Tooling SOAP API in any language that supports Web services.
The IsCheckOnly parameter on ContainerAsyncRequest indicates whether an asynchronous request compiles code but doesn’t execute or save it (true), or compiles and save the code (false).
To access Apex class and trigger data in a structured format, use a SymbolTable.
To add checkpoints to your code for debugging, use ApexExecutionOverlayAction.