Get sites

GET /sites

List all sites owned by account holders in the API consumer’s brand. Optionally, filter the response by searching for a string, and returning only sites that have a mapped domain that contains this string.

By default, only 10 sites will be returned in the response, always starting with the first site created. You can change this behaviour by using the limit and offset parameters. Typically, deleted sites are not included in the response. If you want to include these sites then set the deleted parameter.

Parameters

brandRef integer Required. Retrieve sites for this brand
domain string Return only sites that have a mapped domain that contains this string.
limit integer Set the number of sites that will be returned in the response. By default, only 10 sites will be returned.
offset integer Set the offset to the first site to be returned in the response. By default, the first site will be returned.
deleted integer Include sites in the response that have been soft deleted. By default, deleted sites will not be included.

Response

{
    "sites":
    [
        {
            "ref": 123,
            "databaseSchema": "basekit_site_0123456789abcdef",
            "domains":
            {
                "1234": "example.com",
                "5678": "www.example.com"
            },
            "mobileSiteRef": null
        },
        {
            "ref": 456,
            "databaseSchema": "basekit_site_fedcba9876543210",
            "domains":
            {
                "9012": "another.com",
                "3456": "www.another.com"
            },
            "mobileSiteRef": null
        },
        ...
    ]
}

Get site

GET /sites/:siteRef

Response

{
    "site":
    {
        "ref": 1,
        "reverseParentRef": null,
        "domains":
        {
            "1": "www.example.com"
        },
        "contentMapSite": null,
        "template": 27,
        "primaryDomain":
        {
            "ref": 1,
            "domainName": "www.example.com"
        },
        "lastPublish":
        {
            "date": "2013-08-22 10:01:42",
            "timezone_type": 3,
            "timezone": "Europe\/London"
        },
        "brandRef": 1,
        "version": 79,
        "enabled": true,
        "privateWidgets": null,
        "mobileSiteRef": null,
        "mobile": false,
        "profileRef": 1,
        "redirectToPrimary": false,
        "siteType": "responsive",
        "activationStatus": null,
        "revertType": null,
        "isReversible": false,
        "responsiveSiteRef": null,
        "ready": true,
        "databaseSchema": "basekit_site_784a71fddf189536427b7a9dd2c4482c",
        "databaseRead": 1,
        "databaseWrite": 1,
        "databaseReadUser": "r_1",
        "databaseWriteUser": "w_1",
        "live": false,
        "previouslyPublished": 1,
        "primaryUrl": "www.example.com",
        "accountHolderRef": 1
    }
}

Create a site

POST /sites

Create a new site for the specified account holder. The site must be created in the caller’s brand.

Typically, an account holder will only have one site, but they may have multiple sites. The new site will be created regardless of the number of sites that the account holder is able to publish.

To login a user to one of the sites in their account, see Login User.

Input

accountHolderRef integer Required. Account holder the site belongs to.
brandRef integer Required. Brand to create the site on.
domain string Required. Domain name used to access the site. The domain must have DNS mapped to the environment on which the site is being created. More domains can be added via Map Domain to Site. Max length: 255 characters.
templateRef integer Template to use on the site. If not provided, the site will have a default template.
activationStatus string Can be set to active or inactive. If the site’s brand activationURL is set and the site has an inactive activationStatus, clicking the publish button in the editor will result in a redirect to the aforementioned URL.
siteType string Can be set to desktop or responsive. If you’re unsure of this value, ask your account manager for more information.
Content-Type: application/json
{
    "accountHolderRef": 1,
    "brandRef": 1,
    "domain": "example.com",
}

Response

Status: 201 Created
{
    "site":
    {
        "ref":1,
        "domains":
        [
            {
                "ref":1,
                "domainName":"example.com"
            }
        ],
        "contentMapSite":null,
        "template":null,
        "primaryDomain":
        {
            "ref":1,
            "domainName":"example.com"
        },
        "lastPublish":null,
        "brandRef":1,
        "version":"69",
        "enabled":true,
        "privateWidgets":null,
        "mobileSiteRef":null,
        "mobile":false,
        "profileRef":null
    }
}

Edit site

PUT /sites/:siteRef

This will only update the properties that have been included in the request. All properties that are missing from the request will remain the same.

Input

primaryUrlRef integer Domain to set as primary.
live integer Setting to 1 will make a previously published site accessible. Setting to 0 will make a previously published site inaccessible.
templateRef integer Template to be used by the site
activationStatus integer Can be active or inactive. If the site’s brand activationURL is set and the site has an inactive activationStatus, clicking the publish button in the editor will result in a redirect to the aforementioned URL.
protocol string Can be http or https. If it is configured as https it will force redirection to https. It does not provision a certificate.
alwaysRedirectToPrimaryDomain integer Can be 0 or 1. Setting to 1 will redirect all of the site’s domains to the primary domain.
Content-Type: application/json
{
    "primaryUrlRef": 1,
    "live": 1,
    "enabled": 1
}

Response

Status: 200 OK
{
    "site":
    {
        "ref": 1,
        "reverseParentRef": null,
        "domains":
        {
            "1": "www.example.com"
        },
        "contentMapSite": null,
        "template": 27,
        "primaryDomain":
        {
            "ref": 1,
            "domainName": "www.example.com"
        },
        "lastPublish":
        {
            "date": "2013-08-22 10:01:42",
            "timezone_type": 3,
            "timezone": "Europe\/London"
        },
        "brandRef": 1,
        "version": 79,
        "enabled": true,
        "privateWidgets": null,
        "mobileSiteRef": null,
        "mobile": false,
        "profileRef": 1,
        "redirectToPrimary": false,
        "siteType": "responsive",
        "activationStatus": null,
        "revertType": null,
        "isReversible": false,
        "responsiveSiteRef": null,
        "ready": true,
        "databaseSchema": "basekit_site_784a71fddf189536427b7a9dd2c4482c",
        "databaseRead": 1,
        "databaseWrite": 1,
        "databaseReadUser": "r_1",
        "databaseWriteUser": "w_1",
        "primaryUrl": "www.example.com"
    }
}

Delete site

DELETE /sites/:siteRef

The site’s database is not deleted, but it is marked for deletion and will not be included in further API calls unless deleted sites are explicitly requested.

Response

Status: 204 No Content

Hard delete site

POST /sites/:siteRef/hard-delete

The site database plus all related site records and data are permanently deleted. Use with caution as there is no way to recover site data after this call.

This endpoint is available from v44 onwards.

Response

Status: 204 No Content

Publish site

POST /sites/:siteRef/publish

Note: Available from 7.42 onwards.

Response

Status: 200 OK
{
    "versionRef": 48,
    "lastPublish": {
        "date": "2014-10-07 12:10:10",
        "timezone_type": 3,
        "timezone": "Europe/London"
    }
}

Reset site

POST /sites/:siteRef/reset

Removes all site content.

Response

Status: 204 No Content

Map domain to site

POST /sites/:siteRef/domains

Add a domain mapping to a site. Any subsequent requests to this domain will resolve to the site.

Note that the domain’s DNS needs to point to the site’s environment. For more details about the DNS settings you need, please contact integrations@basekit.com.

Input

domain string Map this domain to the specified site.
Content-Type: application/json
{
    "domain": "example2.com"
}

Response

Status: 201 Created
{
    "domainToSiteMap":
    {
        "ref": 2,
        "siteRef": 1,
        "domain": "example2.com"
    }
}

Unmap domain from site

DELETE /sites/:siteRef/domains/:domainRef

Remove a domain mapping from a site. The domain is completely removed and will no longer be mapped to any site.

Note that if the DNS for the unmapped domain is unchanged then any subsequent requests to this domain will resolve to a holding page.

Response

Status: 204 No Content

Create page

POST /sites/:siteRef/pages

Add a page to a site.

Input

pageUrl string Path of page in URL.
type string Page type. Set as page.
title string Title of the page.
status string Page status. Can be active, inactive, or draft.
Content-Type: application/json
{
    "pageUrl": "test",
    "type": "page",
    "title": "Test"
    "status": "active",
}

Response

Status: 200 OK
{
    "page": {
        "ref": 5,
        "type": "page",
        "status": "active",
        "request": "test",
        "title": "Test",
        "keywords": null,
        "description": null,
        "canPublish": 0,
        "parentId": 0,
        "seoTitle": null,
        "themeRef": null,
        "colorSwatchRef": null,
        "fontSwatchRef": null,
        "headscript": null,
        "bodyscript": null,
        "displayOrder": 2,
        "templateType": "default",
        "hiddenFromNavigation": 0,
        "immutable": 0
    }
}

Create widget

POST /sites/:siteRef/widgets

Adds a widget to a page on a site.

Input

collection string Create the widget as part of this collection. For responsive sites creating widgets inside the main zone, this should be widgets.
name string Widget name. Must be unique inside the parent.
parentId string ID of the parent widget. For responsive sites this will typically need to be page-zones__main.
type string Widget type.
pageRef string Page to create the widget on.
position string Zero based position of the widget inside the parent. Defaults to 0 if not specified.
values string Associative array of initial values for the widget.
Content-Type: application/json
{
    "parentId": "page-zones__main",
    "name": "content1",
    "type": "Widget.Content",
    "collection": "widgets",
    "pageRef": 1,
    "values": {
        "content": "<h1>Test!</h1>"
    }
}

Response

Status: 200 OK
{
    "widget": {
        "ref": 8,
        "id": "page-zones__main",
        "name": "content1",
        "type": "Widget.Content",
        "position": 0,
        "values": [
            {
                "ref": 28,
                "name": "content",
                "value": "<h1>Test!</h1>"
            },
            {
                "ref": 29,
                "name": "localClass",
                "value": "widget-content-T8DT3Z"
            }
        ]
    }
}

Get global values

GET /sites/:siteRef/global-values

Note: Available from 7.45 onwards.

Site global values are global properties of the site. For example headScript or bodyScript. See the global value reference for a list of properties.

Response

Status: 200 OK
{
    "globalValues": [
        {
            "id": 1, 
            "name": "foo", 
            "value": "bar"
        } 
    ]
}

Add global value

POST /sites/:siteRef/global-values

Note: Available from 7.45 onwards.

Input

name string
value string
Content-Type: application/json
{
    "name": "foo",
    "value": "bar"
}

Response

Status: 201 Created
{
    "globalValue": {
        "id": 1, 
        "name": "foo", 
        "value": "bar"
    }
}

Update global value

PUT /sites/:siteRef/global-values/:name

Note: Available from 7.45 onwards.

Input

value string
Content-Type: application/json
{
    "value": "bar"
}

Response

Status: 200 OK
{
    "globalValue": {
        "id": 1, 
        "name": "foo", 
        "value": "bar"
    }
}

Get all the static widget values for a site

GET /sites/:siteRef/static-values

Site static values are properties that affect template widgets on a site. For example a content widget may have a staticWidgetId of content-contacttitle with a named property of showTplWidget that determines whether to hide or show the widget in that template.

Response

Status: 200 OK
{
  "staticValues": [
    {
      "ref": "1",
      "id": "content-contacttitle",
      "name": "showTplWidget",
      "value": "1",
      "created": "2016-09-26 14:13:47",
      "updated": "2016-09-26 14:13:47"
    }
  ], [
    {
      "ref": "2",
      "id": "twitter",
      "name": "username",
      "value": "twitter",
      "created": "2016-09-26 14:13:47",
      "updated": "2016-09-26 14:13:47"
    }
  ]
}

Get a specific widgets static value for a site

GET /sites/:siteRef/static-values/:staticWidgetId

This retrieves a specific static widget value, using the staticWidgetId

Response

Status: 200 OK
{
  "staticValues": [
    {
      "ref": "1",
      "id": "content-contacttitle",
      "name": "showTplWidget",
      "value": "1",
      "created": "2016-09-26 14:13:47",
      "updated": "2016-09-26 14:13:47"
    }
  ]
}

Update site widgets static value

PUT /sites/:siteRef/static-values/:staticWidgetId

Input

name string
value string
Content-Type: application/json
{
    "name": "showTplWidget",
    "value": "0"
}

Response

Status: 200 OK
{
  "staticValues": [
    {
      "ref": "1",
      "id": "content-contacttitle",
      "name": "showTplWidget",
      "value": "0",
      "created": "2016-09-26 14:13:47",
      "updated": "2016-09-26 14:13:47"
    }
  ]
}