Managing BigScoots Cache with WP REST API

Take a look at how you can leverage BigScoots Cache WordPress REST API to perform many actions.

Saumya Majumder avatar
Written by Saumya Majumder
Updated over a week ago

BigScoots Cache already provides the best-in-class page caching solution to any WordPress website hosted in our WPO plan or using our WordPress Speed Optimization Services.

Now you can manage many aspects of BigScoots Cache via our WP REST API.

Here are the common things that you can perform with BigScoots Cache API:

Please note that you need to make each API request in an authenticated way and make sure that the user you are using to access the API is either a WordPress admin user or has the privilege to manage cache inside BigScoots Cache settings.

If you don't know how to do that, please check the loom video attached below.

Generating Application Password to access the API

First, you need to log into your WordPress admin panel and then go to your profile section:

Then you need to scroll down to the Application Passwords section and Add New Application Password.

After generating the Application Password, it will be shown only once. So make sure you copy the application password as it is and store it in a safe place.

Also, note that Application Password might have space " " in them, this is valid. Do not remove the spaces. Save the application password as you see it on the screen after generating it.

You won't be able to see the application password again once you leave the screen.

Now at this point, you will have two things in your hand both of which will be required to make the API request:

  • Your WordPress Username

  • Newly Generated Application Password

You will also need to use Postman to make your first API request. If you don't have a Postman account already, don't worry, just create a free account. That's all you will need.

Now let's take a look at all the API endpoints and the proper way of requesting them.

API Endpoints

Clear Cache

When it comes to the clear cache API endpoint, you can use this endpoint to do the following things:

Now let's take a look at each one of them.

Clear Cache for the Whole Domain (Purge Everything)

API Endpoint: /wp-json/bigscoots-cache/v2/clear-cache

Request Type: PATCH

Request Body:

{
"purge_type": "all"
}

Clear Cache for Post IDs provided by you

API Endpoint: /wp-json/bigscoots-cache/v2/clear-cache

Request Type: PATCH

Request Body:

{
"purge_type": "post_ids",
"post_ids": [1, 17]
}

Please note that you need to pass an Array of Integer post ids in the post_ids field. You cannot pass the post ids as String. It needs to be an Integer Array.

Clear Cache for Post IDs provided by you and its related pages (like archive, taxonomy, etc.)

API Endpoint: /wp-json/bigscoots-cache/v2/clear-cache

Request Type: PATCH

Request Body:

{
"purge_type": "post_ids",
"post_ids": [1, 17],
"purge_related_urls": true
}

Please note that you need to pass an Array of Integer post ids in the post_ids field. You cannot pass the post ids as String. It needs to be an Integer Array.

Clear Cache for URLs provided by you

API Endpoint: /wp-json/bigscoots-cache/v2/clear-cache

Request Type: PATCH

Request Body:

{
"purge_type": "urls",
"urls": ["https://example.com/some-page/", "https://example.com/some-post/", "https://example.com/some-other-post/"]
}

If the API requests are successful you will get a JSON response like this:

{
"success": true,
"status": "success",
"message": "Your request to clear cache has been submitted! Please allow up to 30 seconds for this to take effect."
}

Clear Opcache

API Endpoint: /wp-json/bigscoots-cache/v2/clear-opcache

Request Type: DELETE

Request Body: not needed

On success, you will get a response like this:

{
"success": true,
"status": "success",
"message": "OPcache for your website has been cleared successfully!"
}

Enable Cache

API Endpoint: /wp-json/bigscoots-cache/v2/enable-cache

Request Type: PATCH

Request Body: not needed

On success, you will get a response like this:

{
"success": true,
"status": "success",
"message": "BigScoots Cache has been enabled successfully on your website."
}

Disable Cache

API Endpoint: /wp-json/bigscoots-cache/v2/disable-cache

Request Type: PATCH

Request Body: not needed

On success, you will get a response like this:

{
"success": true,
"status": "success",
"message": "BigScoots Cache has been disabled successfully on your website."
}

Clear Plugin Log

API Endpoint: /wp-json/bigscoots-cache/v2/clear-logs

Request Type: DELETE

Request Body: not needed

On success, you will get a response like this:

{
"success": true,
"status": "success",
"message": "BigScoots Cache plugin log has been cleared successfully."
}

Loom Video Walkthrough

If you are a bit confused about how to use the APIs, take a look at the short loom video below that will walk you through the process using Postman.

Did this answer your question?