Page CRUD operations

Create a page

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

{baseurl}/api/default/pages

Depending on what type of page you want to create, you pass different parameters in the request body. The type of the created page is determined by the request payload.

  • To create a page under another page in the page hierarchy, add the ParentId property to the request payload.
    Set the value of the property to the ID of the parent page.
    If you omit the property, the page will be created on root level.
  • To create a page based on a specific template, add the TemplateId property to the request payload.
    Set the value of the property to the ID of the specific template that you want to base the page on.
    If you omit the property, the page will be based on the default MVC template.

Sample request

POST http://mysite.com/api/default/pages

To create a .NET Core page, you must base it on a .NET Core template. To do this, use one of the following properties:

  • TemplateId
    Set the value of the property to the ID of a specific .NET Core template.
  • TemplateName
    Set the value of the property to the default .NET Core template – NetCore.Default

To create a redirect page, you must set the PageType property to Redirect. You must also specify where the page should redirect, using the RedirectPage object, which holds the redirect page settings.

To create a page that redirects to an external URL, set the RedirectUrl property of the RedirectPage object to the URL of the external page where you want to redirect.

To create a redirect page, you must set the PageType property to Redirect. You must also specify where the page should redirect, using the RedirectPage object, which holds the redirect page settings.

To create a page that redirects to another Sitefinity CMS page, set the NodeId property of the RedirectPage object to the ID of the Sitefinity CMS page where you want to redirect.

Sample response

Create a page translation

When you create the first translation of an item, you are able to choose whether all translations of a page should be in sync, or whether you want to create a split translation of a page that will have different layout and widgets.
For more information, see Translate pages.

To create a page translation, execute a PATCH request to the following endpoint:

{baseurl}/api/default/pages({pageId})?sf_culture={translate_to_culture}

Where:

  • {pageId} is the ID of the page which you want to translate
  • {translate_to_culture} is the culture that you want to create the new translation in

You determine whether the page will be kept in sync with all translations or will be split from the original page, by passing the EnableSync or EnableSplit parameters in the request.

The CopyFrom parameter controls whether you want to copy the page contents from another translation, or whether you want to start from scratch. If you want to start from scratch, omit the CopyFrom parameter. Otherwise, set its value to the culture of the translation that you want to copy from.

Sample request

PATCH http://mysite.com/api/default/pages(917ef635-3099-4a8e-bbd0-298191a4b547)?sf_culture=de

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

Widget operations