Skip to content

Client server Document REST API

Andrea Peltrin edited this page Jul 18, 2022 · 2 revisions

Status: This is a draft document.

Get a single document

GET domain.com/documents/{documentId}

Return the given JSON document, ready to be deserialized by the Elm client:

{
    "schemaVersion": 4,
    "lastUpdatedOn": 1652365136062,
    "collapsedTreeItems": [
        "322e5908-4f4f-46bd-a129-7064b9c3b9e7",
        ...
    ],
    "viewport": { "tag": "Fluid", "args": [] },
    "selectedNodeId": "e7aad29e-b21b-4ca8-87b8-8a9e42c3430b",
    "root": {
        ... 
    }
}

Note: documentId should not by guessable (use GUID or other url-compatible encoding like YT)

Get a list of user documents

GET domain.com/users/{userId}/documents

Return a list of document ID's:

[
    {
        "id": "SomeId",
        "lastUpdatedOn": 1652365136062
    },
    ...
]

We include the lastUpdatedOn so we can convert it in something more readable (e.g."1 week ago") right in the document gallery section.

Save a new docuemnt

POST domain.com/documents/new ...BODY...

Save a new document. Serve will reply with the new document URL.

Update a new document

PUT domain.com/documents/{documentId} ...BODY...

Replace an exiting document with its new version.

Note: All operation requires a valid auth credentials to be sent.