API

Sites

Overview

  1. List your sites
  2. Create a site
  3. Get a site
  4. Update a site
  5. Delete a site
  6. Publish a site
  7. List post tags
  8. List post categories

List your sites

Endpoint

GET https://api.siteleaf.com/v2/sites

Query String Params

Name Desc
sort Should be formated as field-asc or field-desc

Response

Status: 200 OK
Link: <https://api.siteleaf.com/v2/:path?page=2>; rel="next",
      <https://api.siteleaf.com/v2/:path?page=9>; rel="last"
[
  {
      "cname": "username.github.io",
      "created_at": "2015-11-04 15:28:42 -0500",
      "defaults": [],
      "domain": "testsitev2.siteleaf.net",
      "id": "563a6a7a1829c7081b000000",
      "jobs": {
          "preview": {
              "id": null,
              "last_at": "2016-04-12T15:49:28-04:00",
              "last_error": null,
              "last_id": "68f6bc647ab61e01efd4ae27"
          },
          "publish": {
              "id": null,
              "last_at": "2016-04-12T15:41:12-04:00",
              "last_error": "Liquid syntax error (line 6): Variable '{{ fail %}' was not properly terminated with regexp: /\\}\\}/",
              "last_id": "06184063895bb4c819165bee"
          },
          "sync": {
              "id": null,
              "last_at": "2016-04-12T15:57:09-04:00",
              "last_error": null,
              "last_id": "32e0dc8dcebf26a6f1148ef4"
          }
      },
      "metadata": {
          "gems": [
              "jekyll-sitemap"
          ]
      },
      "timezone": "UTC",
      "title": "test site",
      "updated_at": "2016-04-12 15:57:09 -0400",
      "user_id": "533d750e1829c7785c000001",
      "version": "v2"
  }
]

Create a site

Endpoint

POST https://api.siteleaf.com/v2/sites

Input

Name Type Desc
title String Sites title (required)
domain String Sites domain (required)
timezone String Sites timezone, defaults to UTC
metadata Hash<String, *> Arbitrary key/value pairs
defaults Array<Hash> Jekyll defaults, see the Defaults page for more details
empty Boolean Defaults to false, if true doesn’t create the Siteleaf default theme

Example

{
  "title": "Hello World",
  "domain": "example.com",
  "timezone": "America/New_York",
  "metadata": {
    "foo": "bar"
  }
}

Response

Status: 201 Created
{
    "cname": "username.github.io",
    "created_at": "2015-11-04 15:28:42 -0500",
    "defaults": [],
    "domain": "testsitev2.siteleaf.net",
    "id": "563a6a7a1829c7081b000000",
    "jobs": {
        "preview": {
            "id": null,
            "last_at": "2016-04-12T15:49:28-04:00",
            "last_error": null,
            "last_id": "68f6bc647ab61e01efd4ae27"
        },
        "publish": {
            "id": null,
            "last_at": "2016-04-12T15:41:12-04:00",
            "last_error": "Liquid syntax error (line 6): Variable '{{ fail %}' was not properly terminated with regexp: /\\}\\}/",
            "last_id": "06184063895bb4c819165bee"
        },
        "sync": {
            "id": null,
            "last_at": "2016-04-12T15:57:09-04:00",
            "last_error": null,
            "last_id": "32e0dc8dcebf26a6f1148ef4"
        }
    },
    "metadata": {
        "gems": [
            "jekyll-sitemap"
        ]
    },
    "timezone": "UTC",
    "title": "test site",
    "updated_at": "2016-04-12 15:57:09 -0400",
    "user_id": "533d750e1829c7785c000001",
    "version": "v2"
}

Get a site

Endpoint

GET https://api.siteleaf.com/v2/sites/:site_id

Response

Status: 200 OK
{
    "cname": "username.github.io",
    "created_at": "2015-11-04 15:28:42 -0500",
    "defaults": [],
    "domain": "testsitev2.siteleaf.net",
    "id": "563a6a7a1829c7081b000000",
    "jobs": {
        "preview": {
            "id": null,
            "last_at": "2016-04-12T15:49:28-04:00",
            "last_error": null,
            "last_id": "68f6bc647ab61e01efd4ae27"
        },
        "publish": {
            "id": null,
            "last_at": "2016-04-12T15:41:12-04:00",
            "last_error": "Liquid syntax error (line 6): Variable '{{ fail %}' was not properly terminated with regexp: /\\}\\}/",
            "last_id": "06184063895bb4c819165bee"
        },
        "sync": {
            "id": null,
            "last_at": "2016-04-12T15:57:09-04:00",
            "last_error": null,
            "last_id": "32e0dc8dcebf26a6f1148ef4"
        }
    },
    "metadata": {
        "gems": [
            "jekyll-sitemap"
        ]
    },
    "timezone": "UTC",
    "title": "test site",
    "updated_at": "2016-04-12 15:57:09 -0400",
    "user_id": "533d750e1829c7785c000001",
    "version": "v2"
}

Update a site

Endpoint

PUT https://api.siteleaf.com/v2/sites/:site_id

Input

Name Type Desc
title String Sites title
domain String Sites domain
timezone String Sites timezone, defaults to UTC
metadata Hash<String, *> Arbitrary key/value pairs
defaults Array<Hash> Jekyll defaults, see the Defaults page for more details
hosting String Valid options are disabled, ftp, s3, cloudfiles and github
hosting_options Hash<String, String> See the Hosting/Sync page for more details
sync String Valid options are disabled and github
sync_options Hash<String, String> See the Hosting/Sync page for more details

Example

{
  "title": "Hello World",
  "domain": "example.com",
  "timezone": "America/New_York",
  "metadata": {
    "foo": "bar"
  }
}

Response

Status: 200 OK
{
    "cname": "username.github.io",
    "created_at": "2015-11-04 15:28:42 -0500",
    "defaults": [],
    "domain": "testsitev2.siteleaf.net",
    "id": "563a6a7a1829c7081b000000",
    "jobs": {
        "preview": {
            "id": null,
            "last_at": "2016-04-12T15:49:28-04:00",
            "last_error": null,
            "last_id": "68f6bc647ab61e01efd4ae27"
        },
        "publish": {
            "id": null,
            "last_at": "2016-04-12T15:41:12-04:00",
            "last_error": "Liquid syntax error (line 6): Variable '{{ fail %}' was not properly terminated with regexp: /\\}\\}/",
            "last_id": "06184063895bb4c819165bee"
        },
        "sync": {
            "id": null,
            "last_at": "2016-04-12T15:57:09-04:00",
            "last_error": null,
            "last_id": "32e0dc8dcebf26a6f1148ef4"
        }
    },
    "metadata": {
        "gems": [
            "jekyll-sitemap"
        ]
    },
    "timezone": "UTC",
    "title": "test site",
    "updated_at": "2016-04-12 15:57:09 -0400",
    "user_id": "533d750e1829c7785c000001",
    "version": "v2"
}

Delete a site

Endpoint

DELETE https://api.siteleaf.com/v2/sites/:site_id

Response

Status: 200 OK
{
  "id": "5697cc7b16d5640c40000002",
  "deleted": true
}

Publish a site

Compiles and publishes your site in the background, and immediately returns a job id. Use the Jobs API to retrieve status updates.

Endpoint

POST https://api.siteleaf.com/v2/sites/:site_id/publish

Response

Status: 202 Accepted
{
  "job_id": "b9982d904c02307bafadd2a6"
}

List post tags

Returns an array of all unique tags from Documents in the posts Collection.

Endpoint

GET https://api.siteleaf.com/v2/sites/:site_id/tags

Response

Status: 200 OK
["cookies", "milk"]

List post categories

Returns an array of all unique categories from Documents in the posts Collection.

Endpoint

GET https://api.siteleaf.com/v2/sites/:site_id/categories

Response

Status: 200 OK
["apple", "linux", "windows"]

Help improve this page