PlainApp
API குறிப்பு

HTTP ரூட்கள்

HTTP முனையங்கள் GraphQL கோரிக்கைகள், கோப்புப் பரிமாற்றங்கள் மற்றும் சாதன இணைப்புகளைக் கையாளுகின்றன. கோரிக்கை வடிவத்தையும் அங்கீகாரத் தேவைகளையும் அறிய கீழே ஒவ்வொரு முனையத்தையும் பார்க்கவும்.

வகை வரையறைகள்

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>

செயல்பாடுகள்

http

POST /graphql

முதன்மை GraphQL முனையம். API-token முறை c-id மற்றும் Authorization: Bearer தலைப்புகளுடன் JSON-ஐப் பயன்படுத்துகிறது; உள்நுழைவு அமர்வு முறை மறைகுறியாக்கப்பட்ட உடல்களைப் பயன்படுத்துகிறது.

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

மறைகுறியாக்கப்பட்ட வள ID-ஐப் படிக்கவும்: அமர்வுக்கு c.CLIENT_ID.PAYLOAD அல்லது செயலில் உள்ள பகிர்வுக்கு s.SHARE_ID.PAYLOAD. அமர்வு இணைப்புகள் அழைப்பவரின் app.urlToken-ஐப் பயன்படுத்துகின்றன; GraphQL அங்கீகார டோக்கனை அல்ல. இணைப்புகளைத் தனிப்பட்டதாக வைத்திருக்கவும்; அமர்வை ரத்து செய்தால் அவை செல்லாததாகும். செயல்கள்: PREVIEW, DOWNLOAD, PROBE அல்லது TRANSCODE; முன்னோட்ட அளவு: SM அல்லது LG; பைட் வரம்புகள்: HTTP Range. DESCRIBE அணுக அனுமதிக்கப்பட்ட கோப்பு மெட்டாடேட்டாவையும் கோப்பக உருப்படிகளையும் வழங்கும்.

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

அணுக அனுமதியுள்ள கோப்பகத்தை ZIP ஆகப் பதிவிறக்கவும். அமர்வின் வழக்கமான /fs வள ID அல்லது செயலில் உள்ள பகிர்வின் கோப்பக ID-ஐப் பயன்படுத்தலாம். ஒரே நேரத்தில் பல பணிகள் நடந்தால் HTTP 429 திரும்பலாம்.

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

GET /zip/files

தேர்ந்தெடுத்த கோப்புகளை ZIP ஆகப் பதிவிறக்கவும். அமர்வுக்கு மட்டும் உரிய தனி ZIP_FILES ID தேவை. வழக்கமான /fs ID அல்லது பகிர்வு ID ஏற்கப்படாது.

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

GET /health

அங்கீகாரம் இல்லாத அணுகல் சோதனை. சாதாரண உரை உடலாக OK-ஐத் தருகிறது.

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

POST /init

c-id மற்றும் இயக்கப்பட்ட தொலை அணுகல் தேவை. வெற்று உடல் அமைப்பைக் கண்டறிந்து authenticated=false-ஐத் தருகிறது. தற்போதைய அமர்வைச் சோதிக்க அதன் அங்கீகார டோக்கனால் POST /init-க்கான கோரிக்கை உறையை மறைகுறியாக்கவும். பதிலில் httpsPort உள்ளது (HTTPS listener இல்லாவிட்டால் 0); opaquePublicKey மற்றும் TLS சான்றுப் புலங்கள் நிபந்தனைக்குட்பட்டவை.

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. c-id செயலில் உள்ள பகிர்வை அடையாளம் காண்கிறது; API டோக்கன் விருந்தினர் கோரிக்கைக்கு அனுமதி வழங்காது.

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. c-cid: அரட்டை சேனல் ID. சேனல் செய்திகள் c-cid-ஐச் சேர்த்து சேனல் விசையைப் பயன்படுத்துகின்றன; நேரடி பியர் கோரிக்கைகள் அதைத் தவிர்த்து இணைத்தல் விசையைப் பயன்படுத்துகின்றன.

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