Media Deduper Pro exposes REST API endpoints for interacting with the indexer process. These can be used to automate the indexing process using shell scripts or cron jobs on your server.
Accepted request methods and full URLs are given below as examples; replace "yoursite.com" with your actual domain.
POST https://yoursite.com/wp-json/mdd_pro/v2/index/
If the indexer isn't already running, this will start the indexer.
Append ?clean=true to the request URL to wipe the current index data and reindex all content on your site.
Response HTTP status code will always be 200.
GET https://yoursite.com/wp-json/mdd_pro/v2/index_status/
Retrieve data about the indexer status. Response will be a JSON object with the following structure:
{
"processed": 1, // The number of posts and attachments that have been indexed during this indexer run (i.e. since the indexer last started).
"failed": 0, // The number of posts and attachments that have failed to index during this indexer run.
"total": 10, // The number of posts and attachments in the indexer queue for this run.
"error_messages": [], // Array of error messages related to any posts or attachments that failed to index.
"state": "processing" // Either 'processing', 'complete', or 'stopped' ('stopped' indicates that the last run was cancelled).
}
Response HTTP status code will always be 200.
POST https://yoursite.com/wp-json/mdd_pro/v2/index_stop/
Stop the indexer, if it's currently running, and return its status. Response data structure will match that of the /index_status/ endpoint, as described above.
Response HTTP status code will always be 200.
POST https://yoursite.com/wp-json/mdd_pro/v2/bulk_delete_unused/
If the bulk delete unused images process isn't already running, this will start the bulk delete unused process. THIS PROCESS WILL DELETE IMAGES ON YOUR SITE. Used them with caution and always ensure you have taken a backup of your site, database and media library before using this endpoint.
Response HTTP status code will always be 200.
GET https://yoursite.com/wp-json/mdd_pro/v2/bulk_delete_unused_status/
Retrieve data about the bulk delete unused images process status. Response will be a JSON object with the following structure:
{
"processed": 1, // The number of posts and attachments that have been bulk deleted that are unused.
"failed": 0, // The number of posts and attachments that have failed to be bulk deleted that are unused.
"total": 10, // The number of posts and attachments in the bulk deleted that are unused queue for this run.
"error_messages": [], // Array of error messages related to any posts or attachments that failed to bulk delete that are unused.
"state": "processing" // Either 'processing', 'complete', or 'stopped' ('stopped' indicates that the last run was cancelled).
}
Response HTTP status code will always be 200.
POST https://yoursite.com/wp-json/mdd_pro/v2/bulk_delete_unused_stop/
Stop the bulk delete unused images process, if it's currently running, and return its status. Response data structure will match that of the /bulk_delete_unused_status/ endpoint, as described above.
Response HTTP status code will always be 200.
POST https://yoursite.com/wp-json/mdd_pro/v2/smart_bulk_delete/
If the smart bulk delete images process isn't already running, this will start the smart bulk delete process. THIS PROCESS WILL DELETE IMAGES ON YOUR SITE. Used them with caution and always ensure you have taken a backup of your site, database and media library before using this endpoint.
Response HTTP status code will always be 200.
GET https://yoursite.com/wp-json/mdd_pro/v2/smart_bulk_delete_status/
Retrieve data about the smart bulk delete process status. Response will be a JSON object with the following structure:
{
"processed": 1, // The number of posts and attachments that have been smart bulk deleted.
"failed": 0, // The number of posts and attachments that have failed to be smart bulk deleted.
"total": 10, // The number of posts and attachments in the smart bulk deleted queue for this run.
"error_messages": [], // Array of error messages related to any posts or attachments that failed to smart bulk delete.
"state": "processing" // Either 'processing', 'complete', or 'stopped' ('stopped' indicates that the last run was cancelled).
}
Response HTTP status code will always be 200.
POST https://yoursite.com/wp-json/mdd_pro/v2/smart_bulk_delete_stop/
Stop the smart bulk delete images process, if it's currently running, and return its status. Response data structure will match that of the /smart_bulk_delete_status/ endpoint, as described above.
Response HTTP status code will always be 200.