Sites

Sites

The Sites resource is the primary way of publishing and managing any sites, landing pages or any other normal web experiences within the platform.

Site model

Site object

A site object contains the following fields

Example object:

{
  "added": "2013-06-19T11:17:13",
  "base_directory": "/",
  "business_id": 432,
  "business": {
    ... fully expanded `Business` object
  },
  "custom_fields": {
    "headline_one": "Example headline one",
    "headline_two": "Example headline two",
    "bullet_points": [
      "Bullet point one",
      "Bullet point two"
    ]
  }
  "deleted": false,
  "disable_analytics_events": ["form-submit"],
  "domain": "yourdomain.com",
  "extra_css": ".body { background-color: red }",
  "formatted_domain": "www.yourdomain.com",
  "formatted_url": "https://www.yourdomain.com/",
  "footer_code": "<script>...</script>",
  "hash": "934dc52",
  "header_code": "<meta .../>",
  "https": true,
  "id": 1234,
  "language_code": "en-us",
  "linklists": [
    ... configuration of the Site's menu
  ],
  "locations": [
    ... list of associated `Location` objects
  ],
  "logo": {
    ... fully expanded `Logo` object
  },
  "modified": "2014-01-28T13:20:13",
  "noindex": false,
  "partner_site_id": "site-12345",
  "plugins": {},
  "preview_url": "http://934dc52.whitelabel.cloudpreview.net/",
  "published": true,
  "resource_uri": "/api/v2/sites/1234/",
  "screenshot_thumbnail": "https://api.urlbox.io/v1/f45f325d-c052-4f54-a839-e3b6fb93bb73/e751570235f0e814d6e94864aa361552bb234fbb/png?url=http%3A%2F%2F934dc52.whitelabel.cloudpreview.net%2F&width=1280&thumb_width=640&height=800",
  "ssl_last_updated": null,
  "subdomain": "www",
  "theme_id": 123,
  "theme_settings": {
    "body_background_color": "#000000",
    "hide_navigation": false
  },
  "title": "Site Title (internal use only)",
  "trace_id": null,
  "user": {
    ... fully expanded `User` object
  },
  "user_id": 248114,
  "www_primary": true,
  "vanity_domain": "vanitydomain.com"
}

Custom fields

Each site that is built on the platform can be assigned custom_fields values that can then be used throughout templates and pages.

This field can contain a structured JSON object with support for nested values.

"custom_fields": {
  "headline_one": "Example headline one",
  "headline_two": "Example headline two",
  "bullet_points": [
    "Bullet point one",
    "Bullet point two"
  ]
}

From this example, the value can be used in templates via either the macro ($custom_headline_one) or via template variable ({{ site.custom_fields.headline_one }}). More examples here.

Create a site

POST /api/v2/sites/

Required fields

List sites

List all sites including active, deleted, non-published and published

GET /api/v2/sites/

List all active sites

GET /api/v2/sites/?deleted=0

Parameters

Response

{
  "meta": {
    "limit": 20,
    "next": "/api/v2/sites/?limit=20&offset=20",
    "offset": 0,
    "previous": null,
    "total_count": 1039
  },
  "objects": [
    {
      "about": "<p>Here is a description of this Site</p>",
      "added": "2013-06-19T11:17:13",
      "base_directory": "/",
      "business_id": 24305,
      "deleted": false,
      "domain": "cloudpreview.net",
      "formatted_domain": "somesite.cloudpreview.net",
      "formatted_url": "http://somesite.cloudpreview.net/",
      "hash": "934dc52",
      "id": 1281131,
      "keywords": "",
      "modified": "2014-01-28T13:20:13",
      "parent_id": null,
      "partner_site_id": null,
      "partner_sub_id": null,
      "published": true,
      "resource_uri": "/api/v2/sites/1281131/",
      "subdomain": "somesite",
      "theme_id": 449,
      "title": "Site Title (internal use only)",
      "type": "default",
      "user_id": 248114,
      "www_primary": false
    },
    {
      "about": "<p>This is Site number two</p>",
      "added": "2013-06-19T11:17:13",
      "base_directory": "/",
      "business_id": 15555,
      "deleted": false,
      "domain": "cloudpreview.net",
      "formatted_domain": "www.somerealdomain.com",
      "formatted_url": "http://www.somerealdomain.com/",
      "hash": "8c7d6s",
      "id": 1281132,
      "keywords": "",
      "modified": "2014-01-28T13:20:13",
      "parent_id": null,
      "partner_site_id": null,
      "partner_sub_id": null,
      "published": true,
      "resource_uri": "/api/v2/sites/1281132/",
      "subdomain": "www",
      "theme_id": 449,
      "title": "Site Title (internal use only)",
      "type": "default",
      "user_id": 248114,
      "www_primary": true
    },
    ...
  ]
}

Get a single site

Fetch the Site detail using the Site.id

GET /api/v2/sites/:id/

Updating a site

PUT /api/v2/sites/:id/

You can PUT a partial or full object to the detail endpoint to update/change values on the Site object. If using a partial object, you must insure that the primary site id is part of the payload.

Disabling / enabling a site

Disabling a site

To disable an active site and clear all cache references to the domain, use the DELETE method on the Site detail endpoint.

DELETE /api/v2/sites/:id/

Enabling a site

To enable a currently disabled site, you will set the param for deleted to False using the Site update endpoint.

Last updated