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
Attribute
Type
Description
id
integer
unique id of the site
business_id
integer
Reference id to the Business this site is assigned to
business
object
The full Business object expanded
locations
list
List of the assigned Location objects to the site
user_id
integer
Reference id to the User that created this site
deleted
boolean
Field that denotes if the site is disabled or not
base_directory
string
For landing pages, the directory that the page will be published
formatted_domain
string
The hostname/domain where the site is published, including the domain and subdomain (i.e www.example.com)
formatted_url
string
Read-only field that formats the domain, base directory and scheme (i.e. https://www.example.com/)
domain
string
The domain part of the formatted_domain (i.e. example.com)
subdomain
string
The subdomain part of the formatted_domain (i.e. www)
https
boolean
Toggle for enabling SSL for the site
hash
string
Read only and auto-assigned unique hash for the site. Used in preview_url
published
boolean
Toggle for setting the site to a published state. A setting of false (default) will return a 404 if visited on the formatted_url
preview_url
string
Preview URL for this site. Should always be available regardless of published status
title
string
This is the internal name of the site displayed in the site editor user interfaces. Does not show on the published site
custom_fields
object
Custom field values assigned to the site
theme_settings
object
Assigned theme settings values. Support for these values is dependent on the theme
partner_site_id
string
Unique ID reference to partner IDs
language_code
string
The default language (plus specific region) for the site. Similar to the values that browsers send. Examples: en, en-us
theme_id
integer
The assigned Theme object used by the site
disable_analytics_events
list
List of events to disable automatic tracking of
noindex
boolean
Toggle to set the site as non-indexable by search engines
extra_css
string
Extra CSS to add to all the site's pages
footer_code
string
Extra HTML to add to all the site's pages right before the ending </body> tag
header_code
string
Extra HTML to add to all the site's pages right before the ending </head> tag
linklists
list
configuration of the Site's navigation menus
logo
object
fully expanded Logo object
plugins
object
Active site plugins enabled for this site
added
timestamp
Date and time site was created
modified
timestamp
Date and time site was modified
asset_url_prefix
string
Base URL that will be used to prefix static assets. This can be used to enable a CDN for serving these files.
screenshot_thumbnail
string
Link to a thumbnail image preview of the site's homepage
ssl_last_updated
string
Timestamp of when the site's SSL was last updated
www_primary
boolean
Determines if the site should be published prefixed by www. or not
vanity_domain
string
Ability to set a domain, that if pointed, will redirect to this Site

Example object:

1
{
2
"added": "2013-06-19T11:17:13",
3
"base_directory": "/",
4
"business_id": 432,
5
"business": {
6
... fully expanded `Business` object
7
},
8
"custom_fields": {
9
"headline_one": "Example headline one",
10
"headline_two": "Example headline two",
11
"bullet_points": [
12
"Bullet point one",
13
"Bullet point two"
14
]
15
}
16
"deleted": false,
17
"disable_analytics_events": ["form-submit"],
18
"domain": "yourdomain.com",
19
"extra_css": ".body { background-color: red }",
20
"formatted_domain": "www.yourdomain.com",
21
"formatted_url": "https://www.yourdomain.com/",
22
"footer_code": "<script>...</script>",
23
"hash": "934dc52",
24
"header_code": "<meta .../>",
25
"https": true,
26
"id": 1234,
27
"language_code": "en-us",
28
"linklists": [
29
... configuration of the Site's menu
30
],
31
"locations": [
32
... list of associated `Location` objects
33
],
34
"logo": {
35
... fully expanded `Logo` object
36
},
37
"modified": "2014-01-28T13:20:13",
38
"noindex": false,
39
"partner_site_id": "site-12345",
40
"plugins": {},
41
"preview_url": "http://934dc52.whitelabel.cloudbackend.net/",
42
"published": true,
43
"resource_uri": "/api/v2/sites/1234/",
44
"screenshot_thumbnail": "https://api.urlbox.io/v1/f45f325d-c052-4f54-a839-e3b6fb93bb73/e751570235f0e814d6e94864aa361552bb234fbb/png?url=http%3A%2F%2F934dc52.whitelabel.cloudbackend.net%2F&width=1280&thumb_width=640&height=800",
45
"ssl_last_updated": null,
46
"subdomain": "www",
47
"theme_id": 123,
48
"theme_settings": {
49
"body_background_color": "#000000",
50
"hide_navigation": false
51
},
52
"title": "Site Title (internal use only)",
53
"trace_id": null,
54
"user": {
55
... fully expanded `User` object
56
},
57
"user_id": 248114,
58
"www_primary": true,
59
"vanity_domain": "vanitydomain.com"
60
}
Copied!

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.
1
"custom_fields": {
2
"headline_one": "Example headline one",
3
"headline_two": "Example headline two",
4
"bullet_points": [
5
"Bullet point one",
6
"Bullet point two"
7
]
8
}
Copied!
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

Attribute
formatted_domain
theme_id
title

List sites

List all sites including active, deleted, non-published and published
1
GET /api/v2/sites/
Copied!
List all active sites
1
GET /api/v2/sites/?deleted=0
Copied!

Parameters

Name
Type
Description
added__date
string
Filter for sites created on a particular date in YYYY-MM-DD format
business_id
string
Filter for sites associated with a particular Business
deleted
string
Return sites based on if they are active (0) or deleted/disabled (1)
formatted_domain
string
Searching by domain/subdomain similar to how you pass formatted_domain on Site creation
location_id
string
Filter for sites associated with a particular Location
order_by
string
Set the field to sort the results by. Available order_by includes id (default) and title. You can also sort decending by prefixing the field with a minus sign (i.e. order_by=-id)
partner_site_id
string
Used to lookup/search for sites matching a particular internal id

Response

1
{
2
"meta": {
3
"limit": 20,
4
"next": "/api/v2/sites/?limit=20&offset=20",
5
"offset": 0,
6
"previous": null,
7
"total_count": 1039
8
},
9
"objects": [
10
{
11
"about": "<p>Here is a description of this Site</p>",
12
"added": "2013-06-19T11:17:13",
13
"base_directory": "/",
14
"business_id": 24305,
15
"deleted": false,
16
"domain": "cloudbackend.net",
17
"formatted_domain": "somesite.cloudbackend.net",
18
"formatted_url": "http://somesite.cloudbackend.net/",
19
"hash": "934dc52",
20
"id": 1281131,
21
"keywords": "",
22
"modified": "2014-01-28T13:20:13",
23
"parent_id": null,
24
"partner_site_id": null,
25
"partner_sub_id": null,
26
"published": true,
27
"resource_uri": "/api/v2/sites/1281131/",
28
"subdomain": "somesite",
29
"theme_id": 449,
30
"title": "Site Title (internal use only)",
31
"type": "default",
32
"user_id": 248114,
33
"www_primary": false
34
},
35
{
36
"about": "<p>This is Site number two</p>",
37
"added": "2013-06-19T11:17:13",
38
"base_directory": "/",
39
"business_id": 15555,
40
"deleted": false,
41
"domain": "cloudbackend.net",
42
"formatted_domain": "www.somerealdomain.com",
43
"formatted_url": "http://www.somerealdomain.com/",
44
"hash": "8c7d6s",
45
"id": 1281132,
46
"keywords": "",
47
"modified": "2014-01-28T13:20:13",
48
"parent_id": null,
49
"partner_site_id": null,
50
"partner_sub_id": null,
51
"published": true,
52
"resource_uri": "/api/v2/sites/1281132/",
53
"subdomain": "www",
54
"theme_id": 449,
55
"title": "Site Title (internal use only)",
56
"type": "default",
57
"user_id": 248114,
58
"www_primary": true
59
},
60
...
61
]
62
}
Copied!

Get a single site

Fetch the Site detail using the Site.id
1
GET /api/v2/sites/:id/
Copied!

Updating a site

1
PUT /api/v2/sites/:id/
Copied!
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.
1
DELETE /api/v2/sites/:id/
Copied!

Enabling a site

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