Site Meta: Specific Site Data & Billing

The WP Cloud Atomic API provides _data via the site-meta endpoint to store a JSON-encoded array of site-specific data.

This may be used to store various information you may use about the site. However, the primary purpose of _data is to track the billing status of sites and is used by the WP Cloud accounting team.

_data is provided for clients to store a JSON-encoded array of site-specific data not to exceed 1M in size; this string is available via the Atomic API get-sites endpoint, but is not part of the get-site record, nor is it available in the context of the site itself.

  1. Requirements & Restrictions
  2. Current Version
  3. Site Types & Billing
  4. Site Type Examples
  5. Adjusting Site Type via cURL
  6. Adjusting Site Type via Station

Requirements & Restrictions

  • Custom properties may be set; however, WP Cloud hosts must set all properties required by the current WP Cloud _data version and not reuse WP Cloud’s property names.
    • If custom properties are set, it is recommended to use your client name as a prefix to avoid conflicts with future versions. E.g., myhostname_custom_property
  • When updating _data, the entire JSON array must be resent.
  • This string is available via the get-sites endpoint, but is not part of the get-site record, nor is it available in the context of the site itself.
  • _data may not exceed 1M in size.

Current Version

Below is the current version, v1, and the required site_type property for _data.

Ensure the entire JSON is intact and sent when setting and updating.

{
"v1": {
"site_type": "staging"
}
}

Site Types & Billing

The Site Type meta, site_type, is used to help keep a proper inventory of a host’s billable sites for accurate billing.  

Multiple types are available.

  • billable – Marks a site as billable. Live or production sites should be labeled as billable.
  • staging – Classifies an end-user staging site as staging for WP Cloud billing purposes. Not billable.
    • WP Cloud hosts may only offer 1 non-billable staging site per billable site.
    • Must not be a live/production site.
    • Additional “staging” sites should be marked as billable. If the number of staging sites exceeds billable sites, each additional staging site will be billed.
  • internal – Marks a site as an internal development or testing site. Not billable. Internal sites are audited to ensure reasonable usage. May be used by hosts for testing, demos, and general development purposes. Not for use with end-user sites.
  • canary – Not for client use. Reserved for and used by the WP Cloud team. canary sites are sites within your client that are used by WP Cloud for alerting and monitoring against your software environment. Sites with the canary site_type are not billable, should not be deleted, and may be ignored.

Site Type Examples

To mark a site as staging, set the following string via the _data site-meta endpoint.

{
  "v1": {
    "site_type": "staging"
  }
}

To mark a site as billable, such as live production sites, change the site_type property to billable and update the entire JSON.

{
  "v1": {
    "site_type": "billable"
  }
}


Adjusting Site Type via cURL

To set site_type via cURL, we will leverage the site-meta endpoint and update the _data meta with an escaped version of the entire JSON including version information. Each time this is updated, the entire JSON must be sent.

In the example below, we’ll set example.com to be billable.

curl -H 'Auth: API_AUTH_TOKEN' \
-X POST \
--data "value={\"v1\":{\"site_type\":\"billable\"}}" \
https://atomic-api.wordpress.com/api/v1.0/site-meta/example.com/_data/update

You may observe if this is set on a site by calling the get-sites endpoint end include the _data meta like https://atomic-api.wordpress.com/api/v1.0/get-sites/atomic-client-identifier/_data

Within the site list, _data will then be returned and should look something like the following.

"_data": "{\"v1\":{\"site_type\":\"billable\"}}"

Adjusting Site Type via Station

The WP Cloud Station control panel offers site_type controls for administrators via Site Data.