Skip to main content

POST /files/{id}

Description

Creates a new file

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

Parameters

The following path parameters are sent in the request line:

  • id (string) - (required) the ID of a folder where a new file is added

Payload

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

  • name (string) - (required) a file or folder name
  • type (string) - (required) an item type which can be "folder" or "file"

Example:

{ 
name: "New name",
type: "file"
}

Response

The server returns a JSON object with the result data for a file (a new file id and new name):

Example:

{
result:
{
id:"/New name",
name:"New name"
}
}

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: