About Me

My photo
PLANO, Texas, United States
Showing posts with label #Tooling API. Show all posts
Showing posts with label #Tooling API. Show all posts

Thursday, September 17, 2020

Tooling API

What is the Tooling API?

  • Tooling API exposes metadata information of Org
  • We can access Metadata information using REST or SOAP.
  • A Simple use case of tooling api is deleting the debug log from the developer console 

What Can be fetch using Tooling API?

  • Fetch the metadata about Visualforce Pages, Apex Triggers, Apex classes.
  • Get the metadata about an object’s field.
  • Get the Code Coverage details of Apex Classes and Triggers.
  • Retrieve metadata of custom and standard object properties.
  • Retrieve metadata information about Validation Rules and Workflow Rules.
  • We can Create, Update Apex Classes and Apex Triggers.
  • We can get the RecentItems of our dev-org using Tooling API.

Where can Tooling API be used?

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 Ex- Jenkin used tooling api for code coverage validation.
  • Apex classes or trigger deployment

How can Tooling API consume?

Using Apex Code

Tooling API can be consumed using HTTP REST API and SOAP method

  1. HttpRequest req = new HttpRequest();
    req.setHeader('Authorization', 'Bearer ' + UserInfo.getSessionID()); //Get user Session ID
    req.setHeader('Content-Type', 'application/json');
    String SFdomainUrl=URL.getSalesforceBaseUrl().toExternalForm();
    String query='Select+id,FullName,createdDate,TableEnumOrId,ValidationName,Metadata+from+ValidationRule';
    req.setEndpoint(SFdomainUrl+'/services/data/v33.0/tooling/query/?q='+query);
    req.setMethod('GET');
    Http h = new Http();
    HttpResponse response = h.send(req);

Using Workbench












Using the Developer Console

Check Use tooling API while querying the Apex Test class or Debug log 












To know about other integration API at a glance, pls Click here

Wednesday, January 13, 2016

Salsforce API

API stands for Application Programming Interface. With the help of API, we can connect two or more applications altogether. 

To understand the concept of API, let's consider the example of a restaurant. If you go there, you will get a Menu list, and there will be a separate kitchen. You just select the item from the menu list and the waiter will take the order and send it to the chef in the kitchen and once the order is ready, he will deliver to you.  You know need to worry about how the order will come. You just order and you get it from the waiter. Here waiter is working as an API.

There are the following APIs in the Salesforce:

REST API

  • Force.com REST API lets you integrate with the force.com applications using simple HTTP methods.
  • The request/response would be in the form of xml or JSON.
  • Useful in light weighted application like mobile application
  • Click for more detail

SOAP API

  • SOAP API works on SOAP (WSDL) protocol. 
  • The request/response would be in the form of xml.
  • We can use SOAP API to integrate Salesforce with your organization’s ERP and finance systems.
  • Click for more detail

Tooling API

  • As the name itself suggests, use tooling API to build custom development tools for Force.com applications.
  • You can get the code coverage information with the help of Tooling API.

Streaming API

  • Use Streaming API to receive notifications for changes to data that match a SOQL query that you define.
  • Streaming API is useful when you want notifications to be pushed from the server to the client.
  • Streaming API enables you to reduce the number of API calls and improve performance.
  • Click for more detail

Chatter REST API

  • Access Chatter feeds and social data such as users, groups, followers, and files using REST.
  • Click for more detail

Bulk API

  • Bulk API is based on REST principles and is optimized for loading or deleting large sets of data.
  • You can use it to query, insert, update, upsert, or delete many records asynchronously by submitting batches. Salesforce processes batches in the background.
  • SOAP API, in contrast, is optimized for real-time client applications that update a few records at a time. SOAP API can be used for processing many records, but when the data sets contain hundreds of thousands of records, SOAP API is less practical. Bulk API is designed to make it simple to process data from a few thousand to millions of records.
  • The easiest way to use Bulk API is to enable it for processing records in Data Loader using CSV files. Using Data Loader avoids the need to write your own client application.
  • Click for more details

Metadata API

  • Use Metadata API to retrieve, deploy, create, update, or delete customization for your organization. 
  • The most common use is to migrate changes from a sandbox or testing organization to your production environment. 
  • Metadata API is intended for managing customization and for building tools that can manage the metadata model, not the data itself. Like The Force.com Migration Tool, Force.com IDE
  • Click for more detail

Apex REST API

Apex SOAP API
  • Use Apex SOAP API when you want to expose Apex methods as SOAP Web service APIs so that external applications can access your code through SOAP.
  • Click for more detail
To know more about the security aspect of integration, pls Click here