FORMAT: 1A # AeroFS API Playground Welcome to the AeroFS API Playground. This website allows you to interact with a mockup of the API server. For a complete reference of the AeroFS API, please take a look at the [AeroFS API Reference Documentation](https://aerofs.com/docs/api). # Children resource [/api/v0.10/children/{id}] The Children resource contains a list of files and folders under a parent folder. You may use methods on this object to enumerate the AeroFS directory tree belonging to the authenticated user. ### Attributes - **parent** (read-only) Identifier of the parent folder. - **folders** (read-only) List of [Folder](#folder) objects under the parent folder. - **files** (read-only) List of [File](#file) objects under the parent folder. + Parameters + id (optional, folder_id, `9f8e7d...`) Identifier of the parent folder. If absent, list the children of the root AeroFS folder of the authenticated user. + Model (application/json) + Headers ETag: "cb0f09..." + Body ``` { "parent": "9f8e7d...", "folders": [{ "id": "0a1b2c...", "name": "Folder 1", "is_shared": false }, { "id": "0a1b2d...", "name": "Folder 2", "is_shared": true }], "files": [{ "id": "0a1b2e...", "name": "Some File.txt", "last_modified": "2013-12-14T02:19:59Z", "size": 123, "mime_type": "text/plain" }] } ``` ## List children of a folder [GET] List files and folders under a given folder. + Response 200 [Children resource][] # Group Working with folders ## Folder resource [/api/v0.10/folders/{id}] The Folder resource represents a folder in AeroFS. You may use methods on this object to manipulate folders and retrieve their information. ### Attributes - **id** (read-only) Identifier of this folder. - **name** (read-write) Human-readable base name of this folder. - **parent** (write-only) Identifier of this folder's parent folder. - **is_shared** (read-only) Boolean. Whether this folder is a shared folder. + Parameters + id (required, folder_id, `9f8e7d...`) ... Identifier of the folder. + Model (application/json) + Headers ETag: "cb0f09..." + Body ``` { "id": "0a1b2c...", "name": "Important Documents", "is_shared": false } ``` ### Retrieve folder metadata [GET] Given a folder's identifier, return its metadata such as the name and parent folder ID. + Response 200 [Folder resource][] ### Delete a folder [DELETE] Delete a folder and all its children. + Request + Headers If-Match: cb0f09... + Response 204 + Response 412 + Headers Etag: cb0f09... ### Move or rename a folder [PUT] Rename a folder and/or move it to a new parent. The result is undefined if two clients try to move or rename the same folder at the same time without passing an `If-Match` header. Note: return 409 if a folder or file with the same name already exists. + Request (application/json) + Headers If-Match: cb0f09... + Body ``` { "id": "0a1b2c...", "name": "New Name", // (optional) new folder name. "parent": "9f8e7d..." // (optional) id of the new parent folder } ``` + Response 200 (application/json) [Folder resource][] + Response 409 + Headers Etag: cb0f09... + Response 412 + Headers Etag: cb0f09... ## POST /api/v0.10/folders Create a new, empty folder. Returns HTTP code 409 if a folder or file with the same name already exists. + Request (application/json) ``` { "name": "New Folder", "parent": "9f8e7d...", } ``` + Response 201 (application/json) + Headers Location: Etag: + Body ``` { "id": "0a1b2c..", "name": "New Folder", "is_shared": "false", } ``` + Response 409 # Group Working with files ## File resource [/api/v0.10/files/{id}] The File resource represents a file in AeroFS. You may use methods on this object to manipulate files and retrieve their information. ### Attributes - **id** (read-only) Identifier of this file. - **name** (read-write) Human-readable base name of this file. - **parent** (write-only) Identifier of this folder's parent folder. - **last_modified** (read-only) Last modified time of this file, in [ISO 8601 format](#time_format). - **size** (read-only) Long type. Size of this file, in bytes. - **mime_type** (read-only) MIME type of the file, default to `application/octet-stream`. + Parameters + id (required, file_id, `9f8e7d...`) ... Identifier of the file. + Model (application/json) + Headers Etag: cb0f09 + Body ``` { "id": "0a1b2e...", "name": "My File.txt", "last_modified": "2013-03-17T01:23Z", "size": 1234, "mime_type": "text/plain" } ``` ### Retrieve file metadata [GET] Given a file's identifier, return its metadata such as the name and parent folder ID. + Response 200 [File resource][] ### Delete a file [DELETE] + Request + Headers If-Match: cb0f09... + Response 204 + Response 412 + Headers Etag: cb0f09... ### Move a file [PUT] Rename a file and/or move it to a new parent. The result is undefined if two clients try to move or rename the same file at the same time without passing an `If-Match` header. Note: return 409 if a folder or file with the same name already exists. + Request (application/json) + Headers If-Match: cb0f09... + Body ``` { "id": "0a1b2c...", "name": "New Name", // (optional) new file name. "parent": "9f8e7d..." // (optional) id of the new parent folder } ``` + Response 200 (application/json) [File resource][] + Response 409 + Headers Etag: cb0f09... + Response 412 + Headers Etag: cb0f09... ## File content [/api/v0.10/files/{id}/content] + Parameters + id (required, file_id, `9f8e7d...`) ... Identifier of the file. ### Retrieve file content [GET] Given a file's identifier, return its content. If the file is modified on the source computer during the transfer, the connection will be closed before transfer completes. + Request + Headers Range: bytes=0-99 If-Range: "50c17c41b533033c73f1eb99d80bbb32" If-None-Match: "50c17c41b533033c73f1eb99d80bbb32" + Response 200 + Response 206 + Response 304 + Response 416 ### Upload file content [PUT] Overwrite an existing file's content with new content. In cases where unconditional overwrite is not acceptable, the client should first make a [GET request on the content](#get_content). (Alternatively, use a HEAD request with the same parameters as GET to fetch response headers only.) The entity tag in the response header can then be passed to this method in the `If-Match` header. If two clients try to upload new content to the same file at the same time without passing an `If-Match` header, the result is undefined. + Request + Headers If-Match: etag + Body ``` Hello World! This is the new file content. ``` + Response 200 + Headers Etag: cb0f09... + Response 412 + Headers Etag: cb0f09... ## POST /api/v0.10/files Create a new, empty file. Returns HTTP code 409 if a folder or file with the same name already exists. + Request (application/json) ``` { "name": "New File.txt", "parent": "9f8e7d...", } ``` + Response 201 (application/json) + Headers Location: Etag: + Body ``` { "id": "{{ site.data.api.ex_oid }}", "name": "New File.txt", "last_modified": "2013-03-17T01:23Z", "size": 0, "mime_type": "application/octet-stream" } ``` + Response 409