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-टोकन मोड JSON के साथ c-id और Authorization: Bearer हेडर उपयोग करता है; लॉगिन-सत्र मोड एन्क्रिप्टेड बॉडी उपयोग करता है।

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 स्वीकार नहीं होती।

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 लिसनर उपलब्ध न होने पर 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