Page layout operations

Fetch the layout of the 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 fetch the layout, execute a GET request to the following endpoint:

{baseurl}/api/default/pages/Default.Model(url=@param)?@param='{url_encoded_path_of_page}' 

Where {url_encoded_path_of_page} is URL encoded path of the page.

The response:

  • returns the widgets in a hierarchical order if there is nesting (e.g. in sections).
  • holds information about the page fields
  • returns additional scripts
  • returns the SEO information
  • Returns the CSP header values for the referenced scripts and for any custom registrations through Administration/Settings/Advanced/AspNetCoreRenderer/Security/Content-security-policy

Sample requests

'home' path
GET {baseurl}/api/default/pages/Default.Model(url=@param)?@param='home'

'contact us' path
GET {baseurl}/api/default/pages/Default.Model(url=@param)?@param='contact%20us'

'news/articles' path
GET {baseurl}/api/default/pages/Default.Model(url=@param)?@param='news%2farticles'

Sample response

Status code: 200 OK

{
  "@odata.context": "https://localhost/api/default/$metadata#Telerik.Sitefinity.Renderer.Web.Services.Dto.PageDtoWithContext",
  "Culture": "en",
  "SiteId": "3ce2698a-0939-4184-a683-77f87942363b",
  "MetadataHash": "500762965",
  "Id": "4d0450d9-c8b2-40f9-97da-f60d5d5d8166",
  "TemplateName": "NetCore.Default",
  "Renderer": "NetCore",
  "UrlParameters": [],
  "HasVariations": false,
  "Site": {
    "Id": "3ce2698a-0939-4184-a683-77f87942363b",
    "Name": "Default",
    "DefaultCulture": "en",
    "Cultures": [
      "en"
    ],
    "TimeZone": "FLE Standard Time;120;(UTC+02:00) Helsinki, Kyiv, Riga, Sofia, Tallinn, Vilnius;FLE Standard Time;FLE Daylight Time;[01:01:0001;12:31:9999;60;[0;03:00:00;3;5;0;];[0;04:00:00;10;5;0;];];",
    "IsSubFolder": false
  },
  "User": null,
  "ComponentContext": {
    "HasLazyComponents": false,
    "OrphanedControls": [],
    "Components": [
      {
        "Id": "390f1a2d-04bf-45a4-a565-285ac34da325",
        "SiblingId": "00000000-0000-0000-0000-000000000000",
        "Name": "SitefinityContentBlock",
        "PlaceHolder": "Body",
        "Caption": null,
        "ViewName": null,
        "Lazy": false,
        "Key": null,
        "AddAllowed": false,
        "DeleteAllowed": false,
        "EditAllowed": false,
        "MoveAllowed": false,
        "LabelTooltip": null,
        "IsPersonalized": false,
        "WidgetSegmentId": null,
        "Properties": {
            "Content": "Hello World"
        },
        "Children": []
      }
    ],
    "Fields": null,
    "Site": null,
    "User": null
  },
  "Scripts": [
    {
      "Source": null,
      "Value": "{\"IsPagePersonalizationTarget\":false,\"IsUrlPersonalizationTarget\":false,\"PageId\":\"4d0450d9-c8b2-40f9-97da-f60d5d5d8166\"}",
      "Location": "BodyBottom",
      "IsNoScript": false,
      "Attributes": [
        {
          "Key": "Id",
          "Value": "PersonalizationTracker"
        },
        {
          "Key": "Type",
          "Value": "application/json"
        }
      ]
    },
    {
      "Source": "/WebResource.axd?d=NjxTqR2bqTw1rewxxlkHPmUCRauViVIt5vSlYDH8C9uKwv-7vl3d4cW1DJ_2h1egk__yItJIVHxNoDVme5Fww2ucRFEkKu8YQh4Cy2wBpMZuouqxBkYKAuZIg8xOd_LcE-e9SPRzImq2RnxFDEOqgi4hFzcYcRIKVCri3Gud5CAMYNvl5Iosep1oCvLPWm9uZYIu7tCvG-erxUYayMZJQrZWSpHJryS6ndw_OqjJj4I1&t=638460891610563181",
      "Value": null,
      "Location": "BodyBottom",
      "IsNoScript": false,
      "Attributes": [
        {
          "Key": "Type",
          "Value": "text/javascript"
        }
      ]
    }
  ],
  "DetailItem": null,
  "MetaInfo": {
    "Title": "p1",
    "Description": "",
    "HtmlInHeadTag": null,
    "OpenGraphTitle": "p1",
    "OpenGraphDescription": "",
    "OpenGraphImage": null,
    "OpenGraphVideo": null,
    "OpenGraphType": null,
    "OpenGraphSite": null,
    "CanonicalUrl": "https://localhost"
  },
  "Fields": {
    "Title": "p1",
    "UrlName": "p1",
    "LastModified": "2024-03-18T07:08:12.940Z",
    "DateCreated": "2024-03-18T07:08:12.940Z",
    "Crawlable": true,
    "ParentId": "f669d9a7-009d-4d83-ddaa-000000000002",
    "RootId": "f669d9a7-009d-4d83-ddaa-000000000002",
    "IsHomePage": true,
    "AvailableLanguages@odata.type": "#Collection(String)",
    "AvailableLanguages": [
      "en"
    ],
    "ViewUrl": "/p1"
  },
  "CspHeader": {
    "script-src": "https://cdn.insight.sitefinity.com https://dec.azureedge.net https://player.vimeo.com/api/player.js https://www.youtube.com/iframe_api 'self'",
    "style-src": "https://cdn.insight.sitefinity.com https://dec.azureedge.net 'self'",
    "img-src": "https://cdn.insight.sitefinity.com https://dec.azureedge.net 'self'",
    "connect-src": "https://*.insight.sitefinity.com https://*.dec.sitefinity.com 'self'"
  }
}

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?