Upcoming API endpoint additions


#1

Hey everyone,

We’ve added two new API endpoints and a minor tweak to an existing one for everybody to use.

  • File upload endpoint: POST to /api/v1/upload
    Request: { “filename”: string, “content_type”: string, “data”: string (base64) }
    Example: { “filename”: “Test.txt”, “content_type”: “text/plain”, “data”: “VGVzdCBkYXRh”}
    Response: { “url”: “URL to access file” }

  • Document versioning: reading a document now gives you the “version” (long integer) field, which can be used with the next API endpoint to determine if a document has changed.

  • Document check for updates endpoint: POST to /api/v1/doc/check_for_updates
    Request: { “file_ids”: [ array of string ] }
    Response: { “versions”: { map of file_id (string) to version number (long integer) } }
    Note: any inaccessible document or non-existent document will simply be dropped and not show up in the response.

The API documentation site has not YET been updated, we’ll make a deployment to the site in the next few days with the new documentation.

Let me know if you guys run into problems with any of these new endpoints.


API rate limit problematic
#2

This is amazing Shida! Thank you. Can’t wait to try it out.

One thing I noticed. If a document is big we still have to query the entire thing instead of just getting a diff since the version number. So potentially still creates some traffic for large documents. How is dynalist doing this internally?

Cheers!


#3

Internally, if we determine that the client isn’t too far behind, we send an array of "diff"s for each increment in version. Otherwise a full read is done and the client computes its own diff from the last synced version.

Moving on, I think we can expand the API endpoint to send diffs back. Most of the work is going to be documenting how the diffs work.


#4

That would be quite useful I think. Would reduce the network load both for the client and server.

Also, if it is easy to do, you could also add another isBookmark field to the document endpoint. Would make life easier for many things, e.g. as described here Endpoint for retrieving bookmarks