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.
When to Use Tooling API
Use Tooling API when you need fine-grained access to an org’s metadata. Tooling API’s
SOQL capabilities for many metadata types allow you to retrieve smaller pieces of metadata.
Smaller retrieves improve performance, which makes Tooling API a better fit for developing
interactive applications.
Because Tooling API allows you to change just one element within a complex type, it can be easier to use than Metadata API. Other use cases include:
- Source control integration
- Continuous integration
- Apex classes or trigger deployment
Some of the specific tasks you can accomplish using the Tooling API:
- Retrieve metadata about an object’s field: Use FieldDefinition.
- Retrieve custom or standard object properties: Use EntityDefinition.
- Manage working copies of Apex classes and triggers and Visualforce pages and components.: Use ApexClassMember, ApexTriggerMember, ApexPageMember, ApexComponentMember, and MetadataContainer .
- Manage working copies of static resource files.: Use StaticResource.
- Check for updates and errors in working copies of Apex classes and triggers and Visualforce pages and components.: ContainerAsyncRequest
- Commit changes to your organization.: Use ContainerAsyncRequest.
- Set heap dump markers.: Use ApexExecutionOverlayAction
- Overlay Apex code or SOQL statements on an Apex execution.: Use ApexExecutionOverlayAction.
- Execute anonymous Apex.: For sample code, see SOAP Calls and REST Overview.
- Generate log files for yourself or for other users.: Set checkpoints with TraceFlag
- Access debug log and heap dump files.: Use ApexLog and ApexExecutionOverlayResult.
- Manage custom fields on custom objects.: Use CustomField.
- Access code coverage results.: Use ApexCodeCoverage, ApexOrgWideCoverage, and ApexCodeCoverageAggregate.
- Execute tests, and manage test results.: Use ApexTestQueueItem and ApexTestResult.
- Manage validation rules and workflow rules.: Use ValidationRule and WorkflowRule.