Creating and Configure Remote Site Settings via the Tooling API
Introducing Tooling API : Salesforce
Use Tooling API to build custom development tools or apps for Lightning Platform applications. 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.Tooling API provides SOAP and REST interfaces. For example, you can:
- Add features and functionality to your existing Lightning Platform tools.
- Build dynamic modules for Lightning Platform development into your enterprise integration tools.
- Build specialized development tools for a specific application or service.
Tooling API exposes metadata used in developer tooling that you can access through REST or SOAP.
For detailed descriptions of Tooling API objects and the REST resources and SOAP calls that each object supports, see Tooling API Objects.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.
For fetch existing Remote Site setting from Tooling API with below URL :
URL.getSalesforceBaseUrl().toExternalForm()+'/services/data/v41.0/tooling/query?q=Select+Id,EndpointUrl+from+RemoteProxy'
For creating Remote Site setting from Tooling API use below Request code :
String json ='{"FullName":"Remotetest","Metadata":{"disableProtocolSecurity":false,"isActive":true,"url":"https://sanjaykeynotes.blogspot.in","urls":null,"description":"test"}}';
String endpoint = URL.getSalesforceBaseUrl().toExternalForm()+'/services/data/v41.0/tooling/sobjects/RemoteProxy/';
string method = 'POST';
HttpRequest request = new HttpRequest();
request.setHeader('Authorization', 'Bearer ' + UserInfo.getSessionID());
request.setHeader('Content-Type', 'application/json');
request.setEndpoint(endpoint);
request.setMethod(method);
request.setBody(json);
Http http = new Http();
HttpResponse response = http.send(request);
System.Debug('**** Remote Site Response: ' + response.getBody());
Click For More detail and help...
really helpful
ReplyDeleteI cannot thank you enough for the blog.Thanks Again. Keep writing.
ReplyDeletespring boot best course
spring framework online course
will omit your great writing due to this problem.
ReplyDeletebest site to learn spring boot
spring boot online course