Making Your First Request
List your sites, then read one site's content, in two calls.
Two calls are enough to confirm your token works before you write anything larger.
Step 1: List your sites
GET /api/v1/site/ returns every site your account can reach.
Request
curl -H "Authorization: Token $ENINE_TOKEN" \
https://e9sites.com/api/v1/site/
import os
import requests
headers = {"Authorization": f"Token {os.environ['ENINE_TOKEN']}"}
response = requests.get("https://e9sites.com/api/v1/site/", headers=headers)
print(response.json())
Response
[
{"domain": "mysite.e9sites.com", "name": "My Site"}
]
Step 2: Read that site's content
Nearly every other endpoint is scoped to one site, named by its domain in the path.
Request
curl -H "Authorization: Token $ENINE_TOKEN" \
https://e9sites.com/api/v1/site/mysite.e9sites.com/artifacts/
The domain has to match the site's domain exactly -- there are no aliases, and a domain that is not a site returns 404.
If something goes wrong
- 401 -- the token is missing, malformed, or deactivated. Check the header spells Token, not Bearer.
- 403 -- the token is fine, but your role on that site is not high enough for what you asked.
- 404 -- the domain in the path is not a site you can see.