Searching for an example of JSON API of "filesystem"


In our learning management system every user has her own “filesystem” containing files and directories of files. Users can upload and download files and create/edit/delete directories As I want to make this user filesystem accessible via JSON API, I need your help.

I am searching for an example or an API documentation of an existing implementation or even hints how to implement this. Uploading and downloading seems difficult. Any ideas?


I’d suggest you not to use JSON API for file uploading. Because it’s not designed for such things. Because you wouldn’t be able to implement resumable (partial) file upload which is very popular this days.

JSON API could be used to create entities in database after uploading process is completed.


I agree the upload shouldn’t be using a {json:api} message to do the upload itself, however it could be used to provide the upload link for the filesystem, which could then be a standard process. If the URL provided was unique, it the system could know about the completion of the process without any further interaction with the API.

First off, what LMS? :smiley:

After that, you could return a “filesystem” root link as a relationship on the user resource. Each directory could have parent and sub-directory relationships, and file resource relationships for content. To upload, you could provide a file creation resource which would orchestrate the relationships, and return a upload-contents link. To download, you would simply provide the canonical link as a relationship to the file resource.

{json:api} wouldn’t be the way to execute all of the interactions as previously stated, but it could provide all the metadata and links you need to get the rest done in standard fashion.

Good luck, hope it helps!