How to execute execute anonymous through REST API?

How to execute execute anonymous through REST API?

Run your executeAnonymous call through API. Then, We need to make a query to get Id of raw log from ApexLog table. Run below query to get last log from user. After getting Id, We need to make an another call for raw logs. (Optional) Remove trace flags from visibility.

How is rest resource used in tooling API?

Robust examples using REST resources in the Tooling API. The following examples use Apex to execute REST requests, but you can use any standard REST tool to access the Tooling API. Salesforce runs on multiple server instances.

How to execute anonymous apex in Salesforce tooling?

To execute anonymous Apex: req.setEndpoint(‘http://instance.salesforce.com/services/data/v52.0/tooling/executeAnonymous/? To retrieve your Apex classes and triggers, and the global Apex classes and triggers from your installed managed packages: To execute Apex unit tests, use the runTestsSynchronous or runTestsAsynchronous resource.

How to use the rest resource in apex?

To execute Apex unit tests, use the runTestsSynchronous or runTestsAsynchronous resource. This example illustrates how to POST to the runTestsSynchronous resource using JavaScript. The comment blocks show which objects these calls return. Sorry, the document you are looking for doesn’t exist or could not be retrieved.

How to get access to the execute anonymous resource?

For the Execute Anonymous resource: How do I get access to the output/debug log? req.setEndpoint (‘http://na1.salesforce.com/services/data/v28.0/tooling/executeAnonymous/? Retrieves a raw debug log by ID. Available from API version 28.0 or later. Thank you for your reply. Where do I get the ID from when I call the /sobjects/ApexLog/id/Body?

Why does execute anonymous not identify Debug log?

It looks like the response from execute anonymous does not identify the debug log or contain the log. The Dev Console is doing cometd polling for debug logs and I see it get an Id. Then it does they query specifically for the Id of the latest log.

How to reverse engineer execute anonymous in Salesforce?

I actually watched the network traffic when running the Dev Console and doing an execute anonymous to see if I could reverse engineer it. It looks like the response from execute anonymous does not identify the debug log or contain the log. The Dev Console is doing cometd polling for debug logs and I see it get an Id.