Référence de l'API

Routes HTTP

Les points de terminaison HTTP traitent les requêtes GraphQL, les transferts de fichiers et les connexions d’appareils. Consulter chaque point ci-dessous pour son format de requête et ses exigences d’authentification.

Définitions de types

text
# HTTP
https://<device-host>:<https-port>

POST /graphql
POST /guest_graphql
POST /peer_graphql
GET /fs?id=<resource-id>&action=PREVIEW&size=SM
GET /zip/dir?id=<directory-resource-id>
GET /zip/files?id=<selection-archive-id>
POST /upload
POST /upload_chunk
POST /init
GET /health
POST /nearby
ANY /proxy/:peer/*path

# DLNA
GET/HEAD /dlna/description.xml
GET/HEAD /dlna/av-transport/scpd.xml
GET/HEAD /dlna/rendering-control/scpd.xml
POST /dlna/av-transport/control
POST /dlna/rendering-control/control
SUBSCRIBE/UNSUBSCRIBE /dlna/av-transport/event
SUBSCRIBE/UNSUBSCRIBE /dlna/rendering-control/event
GET/HEAD /dlna/media/:id
NOTIFY /dlna/callback

# WebSocket
wss://<device-host>:<https-port>/graphql?cid=<client-id>
wss://<device-host>:<https-port>/auth?cid=<client-id>
wss://<device-host>:<https-port>/screen?cid=<client-id>
wss://<device-host>:<https-port>/status?cid=<client-id>
wss://<device-host>:<https-port>/image_editor?cid=<client-id>

Opérations

http

POST /graphql

Point de terminaison GraphQL principal. Le mode jeton d’API utilise les en-têtes c-id et Authorization: Bearer avec du JSON ; le mode session de connexion utilise des corps chiffrés.

bash
curl 'https://<device-host>:<https-port>/graphql' \
  -H 'c-id: <client-id>' -H 'Authorization: Bearer <api-token>' \
  -H 'Content-Type: application/json' \
  --data '{"query":"{ app { deviceName capabilities access } }"}'
http

GET /fs

Identifiant de ressource chiffré : c.CLIENT_ID.PAYLOAD pour une session ou s.SHARE_ID.PAYLOAD pour un partage actif. Les liens de session utilisent app.urlToken, pas le jeton d’authentification GraphQL. Gardez ces liens privés : révoquer la session les invalide. DESCRIBE renvoie les métadonnées et les entrées du répertoire autorisées. Autres actions : PREVIEW, DOWNLOAD, PROBE et TRANSCODE. Taille d’aperçu : SM ou LG. Demandez les plages d’octets avec HTTP Range.

bash
curl 'https://<device-host>:<https-port>/fs?id=<resource-id>&action=PREVIEW&size=SM' -o thumbnail
curl 'https://<device-host>:<https-port>/fs?id=<resource-id>&action=DOWNLOAD' -OJ
curl 'https://<device-host>:<https-port>/fs?id=<resource-id>&action=DESCRIBE'
# describe JSON: {"entry":{"url":"/fs?id=<resource-id>&action=DOWNLOAD","name":"example.txt","isDir":false,"sizeBytes":10},"children":[]}
# action: DESCRIBE | PREVIEW | DOWNLOAD | PROBE | TRANSCODE
# size: SM | LG (PREVIEW only); v: optional cache version
# Byte ranges use the HTTP Range header.
# id: c.<client-id>.<payload> or s.<share-id>.<payload>
# Session links use app.urlToken, not the GraphQL authentication token.
# Keep resource URLs private; revoking the owning session invalidates its links.
http

GET /zip/dir

Télécharge un répertoire autorisé au format ZIP. Accepte un identifiant de ressource /fs ordinaire provenant d’une session, ou l’identifiant d’un répertoire d’un partage actif. Les opérations simultanées peuvent renvoyer HTTP 429.

bash
curl 'https://<device-host>:<https-port>/zip/dir?id=<directory-resource-id>' -o directory.zip
http

GET /zip/files

Télécharge une sélection de fichiers au format ZIP. Exige un identifiant ZIP_FILES distinct, réservé à la session. Les identifiants /fs et les identifiants de partage ne sont pas acceptés.

bash
curl 'https://<device-host>:<https-port>/zip/files?id=<selection-archive-id>' -o selection.zip
http

GET /health

Vérification d’accessibilité sans authentification. Renvoie le corps en texte brut OK.

bash
curl 'https://<device-host>:<https-port>/health'
http

POST /init

Nécessite c-id et l’accès distant activé. Un corps vide découvre la configuration et renvoie authenticated=false. Pour vérifier une session existante, chiffrer l’enveloppe de requête pour POST /init avec son jeton d’authentification. La réponse inclut httpsPort (0 si aucun service d’écoute HTTPS n’est disponible) ; opaquePublicKey et les champs de preuve TLS sont conditionnels.

bash
curl 'https://<device-host>:<https-port>/init' -X POST -H 'c-id: <client-id>'
# An empty body discovers configuration; it does not prove session authentication.
# To check a session, send an encrypted request envelope bound to POST /init.
http

POST /guest_graphql

API chiffrée limitée à un partage avec son propre contrat invité. c-id identifie un partage actif ; un jeton d’API n’autorise pas une requête invitée.

bash
# Share-scoped encrypted GraphQL, not an API-token request.
# c-id: <share-id>; request bound to POST /guest_graphql.
# Contract: plain-core/schema/guest-api.graphqls
query { sharedInfo { name readOnly requiresPassword entries { name relativePath isDir size } } }
http

POST /peer_graphql

c-id : ID client de l’émetteur. c-cid : ID du canal de discussion. Les messages de canal incluent c-cid et utilisent la clé du canal ; les requêtes directes entre pairs l’omettent et utilisent la clé d’association.

bash
curl 'https://<device-host>:<https-port>/peer_graphql' \
  -H 'c-id: <sender-client-id>' \
  -H 'c-cid: <channel-id>' \
  -H 'Content-Type: application/octet-stream' \
  --data-binary @peer-request.bin \
  --output peer-response.bin