Content API
Base URL: https://traffikco.com/api/elmapi/{project-uuid}. Find the project UUID in
Project settings → Content API.
Authentication
- If Public read access is on (Project settings → Content API), published content can be read without a key.
- Otherwise, create a key under Project settings → API keys and send it as a bearer token. Keys have abilities (read, create, update, delete).
curl "https://traffikco.com/api/elmapi/PROJECT_UUID/blog-posts?limit=10" \
-H "Authorization: Bearer YOUR_KEY"
Endpoints
| Method and path | Purpose |
|---|---|
GET / | Project details and collections |
GET /{collection} | List entries in a collection (by its slug) |
GET /{collection}/{id} | One entry |
POST /{collection} | Create an entry (key with create) |
POST /{collection}/update/{id} | Update an entry (key with update) |
DELETE /{collection}/{id} | Delete an entry (key with delete) |
GET /project-media | List media files |
GET /project-media/{id} | One media file |
Query parameters
| Parameter | Example | Effect |
|---|---|---|
where | where[category]=news | Filter by a field value |
where[price][gt]=10 | Operators: not, in, not_in, lt, lte, gt, gte, between, not_between, like | |
where[id][in]=4,5,9 | Lists are comma separated | |
sort | sort=published_at:desc,title:asc | Sort by one or more fields |
limit, offset | limit=20&offset=40 | Paging (offset needs limit) |
include | include=2 | Expand media and relations up to this depth (0 to 3, default 1) |
locale | locale=de | Content in another language, using the project's fallback chain |
tag | tag=news or tag[]=a&tag[]=b | Entries with all listed tags |
state | state=all | Include drafts (needs an API key); only_draft for drafts only |
timestamps | timestamps | Add created, updated and published times |
Drafts are never returned without an API key, even if the project's API is public.
Images
Image URLs from the media library (/media/...) can be resized and converted with query parameters:
| Parameter | Values |
|---|---|
w, h | Width and height in pixels (rounded up to steps of 20) |
fit | contain (default) or cover (crop to fill) |
fm | webp, jpg or png |
q | Quality, 30 to 95 (default 80) |
For example …/hero.jpg?w=800&h=450&fit=cover&fm=webp.