Skip to main content

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 pathPurpose
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-mediaList media files
GET /project-media/{id}One media file

Query parameters​

ParameterExampleEffect
wherewhere[category]=newsFilter by a field value
where[price][gt]=10Operators: not, in, not_in, lt, lte, gt, gte, between, not_between, like
where[id][in]=4,5,9Lists are comma separated
sortsort=published_at:desc,title:ascSort by one or more fields
limit, offsetlimit=20&offset=40Paging (offset needs limit)
includeinclude=2Expand media and relations up to this depth (0 to 3, default 1)
localelocale=deContent in another language, using the project's fallback chain
tagtag=news or tag[]=a&tag[]=bEntries with all listed tags
statestate=allInclude drafts (needs an API key); only_draft for drafts only
timestampstimestampsAdd 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:

ParameterValues
w, hWidth and height in pixels (rounded up to steps of 20)
fitcontain (default) or cover (crop to fill)
fmwebp, jpg or png
qQuality, 30 to 95 (default 80)

For example …/hero.jpg?w=800&h=450&fit=cover&fm=webp.