V3 Pages API Debuts Bulk Operations & MSF Compatibility

Katie Hoesley
BigCommerce Developer Blog
3 min readMar 18, 2022

--

Have you ever wanted to create multiple pages at once in your BigCommerce storefront, but were limited by API capabilities? Have you ever wanted to update or delete more than one page at a time, but found yourself needing to make numerous API calls in a row to accomplish your task? With the newly released V3 Pages API, bulk operations are here!

What Does the Pages API Do?

The Pages API allows developers to manage content pages like contact forms, RSS feeds, and custom HTML pages. The newly released V3 Pages API now supports batch actions (like deleting, updating and creating multiple pages in one operation) and supports multi-storefront functionality.

What’s New?

The primary updates in V3 are bulk operation support and multi-storefront support compatibility. In V3, any endpoints without `pageId` as a path parameter can now support bulk operations. Users can now create, update, and delete multiple pages with one request. This is especially useful for developers who have needed to make single requests over and over to create, update, or delete in the past.

Multi-Storefront Compatibility

This update allows the Pages API to work with upcoming planned support for multi-storefront functionality. This means that the V3 Pages API will allow developers to create, update, delete, and get channel-specific pages. Stay tuned here, and in the BigCommerce Dev Center for additional information on multi-storefront functionality when it’s released!

Bulk Operation Support

CREATE Pages

In V2 Pages API, developers could send a POST request to create a single page by passing an object of data over in the body of the request, using a request to a URL like:

https://api.bigcommerce.com/stores/{store_hash}/v3/content/pages

The data sent across would look something like:

https://gist.github.com/katiehoesley/35c26d7c0a569c81cb309a7af1438643

Now, developers can bulk create pages by sending a POST request to the same URL. To do this, include an array of objects in the body of the request to create multiple pages at once. That array may look like:

https://gist.github.com/katiehoesley/cf12b03e4b4c837e8e7833e3f6dd3d5f

UPDATE Pages

Developers can now also send a request to a URL that includes the Page ID and omit the Page ID from the body of the request. For example, to update an individual record, you could send a request to a URL that includes the Page ID, like this:

 https://api.bigcommerce.com/stores/{store_hash}/v3/content/pages/{PageID}

with a body that looks like:

https://gist.github.com/katiehoesley/2fb65b56d2c8f9caee1addb70b934b7c

This endpoint below now supports bulk UPDATE operations.

https://api.bigcommerce.com/stores/{store_hash}/v3/content/pages/

To update multiple pages at once, the approach is similar to bulk creating pages. Send a PUT request with an array of objects in the body, each object including the ID of the page it’s meant to update. The body of that PUT request could look something like:

https://gist.github.com/katiehoesley/b92deb185e35f0c0291fc4d6c35a5bac

DELETE Pages

To delete one page at a time, send a DELETE request to an endpoint like:

https://api.bigcommerce.com/stores/{store_hash}/v3/content/pages/{pageID}

To delete multiple pages at once using V3 Pages API, developers can format a bulk delete request by just adding comma-separated IDs to the end of the URL. The request will look something like:

https://api.bigcommerce.com/stores/{store_hash/v3/content/pages/4 or v3/content/pages?id:in={id},{id},{id}…

GET Pages

Get requests work almost the exact same as in the V2 Pages API; the only difference is that there is now an option whether or not to include the body in the response (the default is to not send the body in the response).

For developers who do want to see the body in the response, the URL to GET one individual page would look like:

https://api.bigcommerce.com/stores/{store_hash}/v3/content/pages/{pageID}?include=body

And if a user wanted to see the body in the response for a list of pages, the URL for the request would look like:

https://api.bigcommerce.com/stores/{store_hash}/v3/content/pages?include=body

Learn More

These updates to the Pages API significantly simplify bulk operations that developers using the BigCommerce platform need to make. To dig in deeper, please visit the official documentation for this version of the API in the BigCommerce Dev Center: Pages V3

We're excited to announce this API and we hope it makes theme management more efficient for your team. If you have any feedback on our documentation, please share them via the submission form in the BigCommerce Dev Center or let us know below!

--

--

Katie Hoesley
BigCommerce Developer Blog

Hi! I’m Katie - Senior Developer Advocate for BigCommerce & based in Colorado! 🤠🏔🥾👾?