is there a way to delete reports when only have just the report id i have tried the free report manager delete but it seems that only works if the reports are all in the same folder so does anyone know a tool that will allow me to delete reports just using the report id and not doing it manually
Hi David ,
I was able to delete the report by specifying the Id by calling the API using CURL commands.
For Linux, continuous processing is possible by using the following shell script. I think it is possible to change the Id part by inserting data using Excel or the like.
#!/bin/bash
access_token='00D2x000006QA3P!ARcAQJoF13Gv0RnHAQHPFQTeml_xz.KxT_u7wTLleQu.TYUszPZAE6PHVYhUkGM4QOySONvtCKKCZ19Po4HjT3m5Q6AXGmRl'
instance_url='https://xxxxxx-3moqt3-dev-ed.my.salesforce.com'
curl -s -S --tlsv1.2 $instance_url/services/data/v53.0/analytics/reports/reportId_01 -H "Authorization: Bearer $access_token" -X DELETE
curl -s -S --tlsv1.2 $instance_url/services/data/v53.0/analytics/reports/reportId_02 -H "Authorization: Bearer $access_token" -X DELETE
curl -s -S --tlsv1.2 $instance_url/services/data/v53.0/analytics/reports/reportId_03 -H "Authorization: Bearer $access_token" -X DELETE
The procedure was as follows.
1. Creating a connected application. (I'll use the Consumer Key and Consumer Secret later)
2. Make sure you have the "Enable API" permission
3. Enabling OAuth settings for API integration
https://developer.salesforce.com/docs/atlas.en-us.234.0.api_rest.meta/api_rest/quickstart_prereq.htm
Authorization Through Connected Apps and OAuth 2.0
If you can set the above, you can get an access token.
Actually, make it in one line without line breaks.
curl -s -S --tlsv1.2 https://MyDomainName.my.salesforce.com/services/oauth2/token
-d 'grant_type=password'
-d 'client_id=consumer-key'
-d 'client_secret=consumer-secret'
-d 'username=my-login@domain.com'
-d 'password=my-password'
-d 'format=xml'
1. Set the consumer-key obtained earlier after client_id.
2. Set the consumer-secret obtained earlier after client_secret.
3. Set the username for this org after username.
4. Set the password for this org after password.
5. -d'format = xml'is an option to change the standard Json output to Xml format.
When this command is executed, the following result will be returned.
The content has been slightly modified.
access_token 00D2x000006QA3P!ARcAQJoF13Gv0RnHAQHPFQTeml_xz.KxT_u7wTLleQu.DPDszPZAE6PHVYhUkGM4QOySONvtCKKCZ19Po4HjT3m5Q6AXGmRl
instance_url https://xxxxxx-3moqt3-dev-ed.my.salesforce.com
id https://login.salesforce.com/id/00D2x000006QA3PEAW/0052x000002rxxxxAU
token_type Bearer
issued_at 164429477eerr6
signature 5YPgl1m0FggjT1mSKUy/cFg7sv4b9Jr6LYv4pQ2G0eA=
Actual Curl processing
curl -s -S --tlsv1.2 $instance_url/services/data/v53.0/analytics/reports/00O2x000003lQBlEAM
-H "Authorization: Bearer $access_token"
-H "X-PrettyPrint:1"
-X DELETE
Set $instance_url to the value of instance_url.
Set $access_token to the value of access_token.
00O2x000003lQBlEAM is the Id of the report you want to erase.
Now you can erase the report.