Skip to main content

PUT /files

Description

Moves or copies a single or multiple files to a specified location

The route handles the HTTP PUT request made to the /files path.

Payload

The server needs to receive a JSON object with the next parameters:

  • operation (string) - (required) the operation name which can be "copy" or "move"
  • target (string) - (required) the path to a folder where to move/copy files
  • ids (array) - (required) ids of files and/or folders to be moved/copied (which are paths to files and folders)

Example:

{
operation: "move",
target: "/Code",
ids: ["/Music", "/Cards"]
}

Response

The server returns a JSON object with the result array of moved/copied files (with a new id and new name for each file)

Example:

{
result:
[
{
id: "/Code/Music",
name:"/Music"
},
{
id: "/Code/Cards",
name:"/Cards"
},
]
}

The HTTP status code shows whether the request succeeds (response.status == 200) or fails (response.status == 500). In case of a failure the error text is returned.


Related articles: