Page lifecycle operations

Get the state of a page

The GetState method returns the current version of the page and other information denoting whether editing or adding new components on the page is allowed.

To get the state of a page, execute a GET request to the following endpoint:

{baseurl}/api/default/pages({page_id})/Default.GetState

Where {page_id} is the ID of the page whose status you want to get.

Sample request

GET http://mysite.com/api/default/pages(917ef635-3099-4a8e-bbd0-298191a4b547)/Default.GetState

Sample response

In this response the version is 264, which denotes that the page has been published or saved as draft more than 200 times.

The AddAllowed and EditAllowed properties are false, because the page was locked when the request was made.

Lock a page

It is important to lock the page before modifying it, because this way other users can see that this page is being edited by someone else and they will see a message that it is currently not available for modifications on their end.

PREREQUISITES: To lock a page, you must know its version. To get the version of page, use Get the state of a page procedure above.

To lock a page, execute a POST request to the following endpoint:

{baseurl}/api/default/pages({page_id})/Default.Lock

Where {page_id} is the ID of the page which you want to lock.

Sample request

POST http://mysite.com/api/default/pages(917ef635-3099-4a8e-bbd0-298191a4b547)/Default.Lock

In this request, you must send the page version. The version number is incremented by 1 every time a change to the state of the page is made. For example, when you publish a page or add a widget to it.

Sample response

No response body

Unlock а page

Unlocking a page is an operation that changes the state of a page from locked to unlocked. After you have finished editing a page, you should unlock it.

To unlock a page, execute a POST request to the following endpoint:

{baseurl}/api/default/pages({page_id})/Default.Unlock

Where {page_id} is the ID of the page you want to unlock.

Sample request

POST http://mysite.com/api/default/pages(917ef635-3099-4a8e-bbd0-298191a4b547)/Default.Unlock

Sample response

No response body

Publish a page

For any changes to the layout of a page to take effect, you must publish the page.

To publish a page, execute a POST request to the following endpoint:

{baseurl}/api/default/pages({page_id})/operation

Where {page_id} is the ID of the page you want to publish.

In response body, you must specify the type of the operation – in this example, Publish.

Sample request

POST http://mysite.com/api/default/pages/(917ef635-3099-4a8e-bbd0-298191a4b547)/operation

In this request, the action is set to Publish. You can also specify other actions, such as Schedule.

Sample response

Schedule a page to be published or unpublished

For any changes to the layout of a page to take effect, you must publish the page. You can also schedule a page to be published on a specific date or unpublished on a specific date, or both.

To schedule a page for publishing or unpublishing, execute a POST request to the following endpoint:

{baseurl}/api/default/pages({page_id})/operation

Where {page_id} is the ID of the page which you want to publish or unpublish.

In response body, you must specify the type of the operation – in this example, Schedule. You must also specify the date when you want to publish or unpublish a page, or, in this case, both.

Sample request

POST http://mysite.com/api/default/pages/(917ef635-3099-4a8e-bbd0-298191a4b547)/operation

In this request, the action is set to Schedule. You can also specify which date the page should be published on and which date it should be unpublished on.

Sample response

Increase your Sitefinity skills by signing up for our free trainings. Get Sitefinity-certified at Progress Education Community to boost your credentials.

Get started with Integration Hub | Sitefinity Cloud | Sitefinity SaaS

This free lesson teaches administrators, marketers, and other business professionals how to use the Integration hub service to create automated workflows between Sitefinity and other business systems.

Web Security for Sitefinity Administrators

This free lesson teaches administrators the basics about protecting yor Sitefinity instance and its sites from external threats. Configure HTTPS, SSL, allow lists for trusted sites, and cookie security, among others.

Foundations of Sitefinity ASP.NET Core Development

The free on-demand video course teaches developers how to use Sitefinity .NET Core and leverage its decoupled architecture and new way of coding against the platform.

Was this article helpful?

Next article

Page CRUD operations