Skip to content

Jotta protocol 5 Events

Torbjorn Tyridal edited this page Mar 23, 2017 · 7 revisions

Get web token

GET api.jottacloud.com/rest/token/<username>/createToken
User-Agent: Mozilla/5.0
x-auth-token: <token.access_token>

Return:

<token>
  <username>...</username>
  <authToken>...</authToken>
</token>

Subscribe to events (websockets)

url: websocket.jottacloud.com /ws/<token.username>/<token.authToken>

Communication is json objects

After protocol upgrade, send:

{"SUBSCRIBE":{
  "path":"ALL",
  "UA": "Desktop_Jottacloud.3.1.61.564.Windows_8.6.2.9200.x86_64"
}}

At appropriate intervals send

{'PING': 'Ok'}

Server messages

{'SUBSCRIBE': {'LAST_UUID': 'xxxxxx-xxxx-xxxx-xxxx-xxxxxxxx', 'PATH': 'ALL'}}
{'PONG': 'ok'}

Event messages

The server will send Event messages as notifications to various actions on the jfs.

The Event message has a general form:

{"EVENT":{
  "U":"<username>",
  "A":"<username>",
  "T":"PATH|META",
  "ST":"<type>",
  "TS":<timestamp>,
  "D":{...},
  "uuid":"<uuid>",
  "unixnano":sssss.nnnnn},
"Length":nnn}
Field Description
U user name (of event receiver or object owner?)
A Acting user, typically same as U, but may be different for shared objects
T Target(?) can have value META or PATH depending on the event
ST Event reason/type CREATE_DEVICE, CREATE_DIR, MOVE_DIR NEW_UPLOAD, RESTORE_MP DELETE_DEVICE DELETE_MP DELETE_DIR DELETE HARD_DELETE_FILE INIT_SHARE_FOLDER ACCEPT_SHARE_FOLDER_INVITE SHARE_FILE UNSHARE_FILE (and the missing obvious ones, CREATE_MP etc)
TS Timestamp
D Data, ST dependent
uuid Event identifier ?
unixnano Timestamp, struct timespec as a float ?

ST=NEW_UPLOAD

T=PATH

  "D":{
    "FROM":"/<username>/Jotta/Archive/<folder>/<file>",
    "actorDevice":"Jotta",
    "created":"<iso-time>",
    "dfs":"<????>",
    "fileuuid":"<uuid>",
    "md5":"<md5>",
    "mimeType":"<mimetype>",
    "modified":"<iso-time>",
    "revision":"1",
    "size":"377",
    "updated":"<iso-time>",
    "uuid":"<uuid>",
    "x-id":"<someid>"},

ST=CREATE_DIR

T=PATH

  "D":{
    "FROM":"/<username>/Jotta/Archive/<folder>/<folder>",
    "actorDevice":"WEBAPP",
    "uuid":"<uuid>",
    "x-id":"<someid>"},

ST=CREATE_DEVICE

T=PATH

  "D":{
    "FROM":"/<username>/<device>/null",
    "uuid":"<uuid>",
    "x-id":"<someid>"},

ST=MOVE_DIR

T=PATH

  "D":{
    "FROM":"/<username>/Jotta/Sync/New folder",
    "TO":"/<username>/Jotta/Sync/sharedfolder",
    "actorDevice":"<devicename>",
    "uuid":"","x-id":""},

ST=RESTORE_MP

T=PATH

  'D': {
     'uuid': '<uuid>', 
     'x-id': '<someid>', 
     'FROM': '/<username>/<device>/.../<item>'}, 

ST=DELETE_DEVICE

T=PATH

  'D': {
    'actorDevice': 'WEBAPP', 
    'uuid': 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx', 
    'x-id': '<someid>', 
    'FROM': '/<username>/<device>/null'}, 

ST=DELETE_MP

T=PATH

  'D': {
    'uuid': 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx', 
    'x-id': '<someid>', 
    'FROM': '/<username>/<device>/<mountpoint>'}, 

ST=DELETE_DIR

T=PATH

  'D': {
    'actorDevice': 'WEBAPP', 
    'uuid': 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx', 
    'x-id': '<someid>', 
    'FROM': '/<username>/<device>/<mount>/.../<folder>'}, 

ST=DELETE

T=PATH

  "D":{
    "FROM":"/<username>/Jotta/Archive/<folder>/<file>",
    "actorDevice":"WEBAPP",
    "created":"<iso-time>",
    "dfs":"<?????>",
    "fileuuid":"<uuid>",
    "md5":"<md5>",
    "mimeType":"<mimetype>",
    "modified":"<iso-time>",
    "revision":"1",
    "size":"377",
    "updated":"<iso-time>",
    "uuid":"<uuid>",
    "x-id":"<someid>"},

ST=HARD_DELETE_FILE

T=PATH

  "D":{
    "FROM":"/<username>/Jotta/Archive/<folder>/<file>",
    "actorDevice":"WEBAPP",
    "uuid":"<uuid>",
    "x-id":"<someid>"},

ST=INIT_SHARE_FOLDER

T=META

  "D":{
    "FROM":"/<username>/Jotta/Sync/sharedfolder",
    "members":"",
    "owner":"<username>",
    "shareId":"<uuid1>",
    "uuid":"<uuid2>",
    "x-id":"<someid>"},

ST=ACCEPT_SHARE_FOLDER_INVITE

T=META

  "D":{
    "FROM":"/<userid>/Jotta/Sync/sharedfolder",
    "members":"<other_userid>",
    "owner":"<userid>",
    "shareId":"<uuid1>",
    "uuid":"<uuid2>",
    "x-id":""},

ST=SHARE_FILE

T=PATH

  "D":{
    "FROM":"/<username>/Jotta/Archive/>folder>/<file>",
    "actorDevice":"WEBAPP",
    "uuid":"xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
    "x-id":"<someid>"},

ST=UNSHARE_FILE

T=PATH

  "D":{
    "FROM":"/<username>/Jotta/Archive/<folder>/<file>",
    "actorDevice":"WEBAPP",
    "uuid":"xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxx",
    "x-id":"<someid>"},