Skip to content

REST Examples

Joseph Mattiello edited this page Nov 10, 2026 · 6 revisions

These examples use curl in a shell. Set ECS_BASE to the origin of your server. The default is http://127.0.0.1:8473 on the server computer. For a remote server, use its configured HTTPS origin.

Check a server

ECS_BASE=http://127.0.0.1:8473
curl --fail --silent --show-error "$ECS_BASE/health"
curl --fail --silent --show-error "$ECS_BASE/api/v1/capabilities"

Read the protocol and features fields before choosing a client flow. The installed Swagger UI and OpenAPI document are available under the same origin. API reference

Browse a library and download content

Set ECS_TOKEN from an authorized session or a device token with read access. Avoid saving the token in shell history. The helper sends the header from standard input.

ecs_read() {
  printf 'Authorization: Bearer %s\n' "$ECS_TOKEN" |
    curl --fail --silent --show-error --header @- "$@"
}

ecs_read "$ECS_BASE/api/v1/browse-libraries"

# Replace LIBRARY_ID with an ID from the previous response.
ecs_read --get "$ECS_BASE/api/v1/browse" \
  --data-urlencode 'libraryId=LIBRARY_ID' \
  --data-urlencode 'category=games' \
  --data-urlencode 'limit=10'

For the next page, use the returned nextCursor as cursor with the same filters and sort. Stop at null. For a managed item, fetch its manifest and use the files' contentPath values. For a scanned source, use source.contentPath. For an asset, use /api/v1/files/ASSET_ID/content. Resolve paths against your configured server origin before attaching authorization.

# Managed game example.
ecs_read "$ECS_BASE/api/v1/items/ITEM_ID/manifest"

# Original scanned source example. Replace SOURCE_ID with the selected source ID.
ecs_read --output game.download "$ECS_BASE/api/v1/sources/SOURCE_ID/content"

For a resumable transfer, keep the ETag and send Range: bytes=<local size>- with If-Range. Append only if the response is 206 and Content-Range starts where your local file ends. On 200, replace the partial file. Inspect Content-Range or send HEAD before retrying a 416. Client integration guide

Poll for changes

ecs_read --get "$ECS_BASE/api/v1/changes" \
  --data-urlencode 'cursor=0' \
  --data-urlencode 'limit=50'

Store the returned nextCursor after you process the page. Use that cursor on the next request with the same access scope. Stop draining when the cursor stops advancing and poll again later. Device clients can send excludeOwnDevice=1 to skip their own changes. Sync workstream

Pair a device or manage uploads

  • Device pairing. Create a request with POST /api/v1/device-pairing and the device name. Show the PIN to the owner and keep the challenge secret on the requesting device. After owner approval, redeem the request for a read-only device token. Pairing flow
  • Resumable upload. Create an upload session, send bytes in order with Content-Range, then call the completion endpoint. After an interruption, get the session's saved offset before resuming. Upload recovery
  • Scoped investigation. Create a library-scoped grant with an owner token, then use the returned investigator credential for the permitted /api/v1/investigator operations. The owner reviews proposals in library activity. Investigator guide

Error responses use application/problem+json. Include the request ID when asking for support.

Clone this wiki locally