Sites
Create sites, read and update configuration, list and import themes.
| Endpoint | What it does |
|---|---|
| GET /api/v1/site/ | List every site you can reach |
| POST /api/v1/site/ | Create a site. domain is required |
| GET /api/v1/site/{site}/ | Export the site. Add ?dl=json, yaml, csv, zip, or media |
| POST /api/v1/site/{site}/ | Upsert content into the site |
| GET /api/v1/site/{site}/configure/ | Read config, theme, colours, design, and style |
| POST /api/v1/site/{site}/configure/ | Update any of those |
| GET /api/v1/site/{site}/themes/ | List themes this site can select |
| GET /api/v1/site/{site}/custom-themes/ | Export a custom theme. Requires ?name= |
| POST /api/v1/site/{site}/custom-themes/ | Import or update a custom theme |
| POST /api/v1/site/{site}/random-subdomain/ | Give the site a new random subdomain |
Creating a site
Request
curl -X POST \
-H "Authorization: Token $ENINE_TOKEN" \
-H "Content-Type: application/json" \
-d '{"domain": "mysite.e9sites.com", "name": "My Site"}' \
https://e9sites.com/api/v1/site/
import os
import requests
payload = {"domain": "mysite.e9sites.com", "name": "My Site"}
response = requests.post(
"https://e9sites.com/api/v1/site/",
json=payload,
headers={"Authorization": f"Token {os.environ['ENINE_TOKEN']}"},
)
print(response.status_code, response.json())
Response
{"domain": "mysite.e9sites.com"}
You get 201 on success and 409 if the domain is already taken.
The API gives you exactly what you asked for and nothing more: no sample content, no default hero image, no generated SEO pages. Those conveniences belong to the manager. If you want them here, ask for them explicitly.
Changing configuration
Request
curl -X POST \
-H "Authorization: Token $ENINE_TOKEN" \
-H "Content-Type: application/json" \
-d '{"theme": "print", "config": {"title": "My Site", "subtitle": "Built with the API"}}' \
https://e9sites.com/api/v1/site/mysite.e9sites.com/configure/
Media fields inside config take the integer id of a media row -- see Media.