Skip to content

Folder methods

Fedor Kuznetsov edited this page Jun 29, 2023 · 1 revision

POST folder/add

Description:

This endpoint is used to add a new folder to the system. The user needs to provide a valid token and the desired folder name for creating a new folder.

Request:

The request should be a JSON object containing the following fields:

  • token (string, required): A valid authentication token.
  • folderName (string, required): The desired name for the new folder.

Example:

{
  "token": "example_token",
  "folderName": "example_folder"
}

Response:

If the folder creation is successful, the server will return a JSON object with the following fields:

  • folderId (number): The unique identifier of the newly created folder.
  • message (string): A success message indicating that the folder was successfully created.
  • isSuccess (boolean): A boolean value indicating whether the folder creation was successful or not.

Example:

{
  "folderId": 1234,
  "message": "Folder 'example_folder' created successfully.",
  "isSuccess": true
}

POST folder/delete

Description:

This endpoint is used to delete a folder from the system. The user needs to provide a valid token and the ID of the folder to be deleted.

Request:

The request should be a JSON object containing the following fields:

  • token (string, required): A valid authentication token.
  • folderId (number, required): The ID of the folder to be deleted.

Example:

{
  "token": "example_token",
  "folderId": 1234
}

Response:

If the folder deletion is successful, the server will return a JSON object with the following fields:

  • message (string): A success message indicating that the folder was successfully deleted.
  • isSuccess (boolean): A boolean value indicating whether the folder deletion was successful or not.

Example:

{
  "message": "Folder with ID 1234 has been deleted successfully.",
  "isSuccess": true
}

POST folder/rename

Description:

This endpoint is used to rename a folder in the system. The user needs to provide a valid token, the ID of the folder to be renamed, and the new name for the folder.

Request:

The request should be a JSON object containing the following fields:

  • token (string, required): A valid authentication token.
  • folderId (number, required): The ID of the folder to be renamed.
  • newFolderName (string, required): The new name for the folder.

Example:

{
  "token": "example_token",
  "folderId": 1234,
  "newFolderName": "new_folder_name"
}

Response:

If the folder renaming is successful, the server will return a JSON object with the following fields:

  • folderId (number): The ID of the renamed folder.
  • message (string): A success message indicating that the folder was successfully renamed.
  • isSuccess (boolean): A boolean value indicating whether the folder renaming was successful or not.

Example:

{
  "folderId": 1234,
  "message": "Folder with ID 1234 has been renamed to 'new_folder_name' successfully.",
  "isSuccess": true
}

POST folder/get

Description:

The purpose of this endpoint is to retrieve information about a specific folder in the system. The user must provide a valid token and the ID of the folder they want to get information about.

Request:

The request must be a JSON object that includes the following fields:

  • token (string, required): A valid authentication token.
  • folderId (number, required): The ID of the folder to get information about.

Example:

{
  "token": "example_token",
  "folderId": 0
}

Response:

If the request is successful and the folder exists in the system, the server will respond with a JSON object containing the following fields:

  • message (string): A success message indicating that the folder information has been retrieved successfully.
  • isSuccess (boolean): A boolean value indicating whether the folder retrieval was successful or not.

Example:

{
  "message": "Folder information retrieved successfully.",
  "isSuccess": true
}

POST folder/getAll

Description:

The purpose of this endpoint is to retrieve information about all folders in the system. The user must provide a valid token.

Request:

The request must be a JSON object that includes the following field:

  • token (string, required): A valid authentication token.

Example:

{
  "token": "example_token"
}

Response:

If the request is successful, the server will respond with a JSON object containing the following fields:

  • folders (array): An array of objects, each representing a folder in the system. Each object will have the following fields:
    • id (number): The ID of the folder.
    • name (string): The name of the folder.
  • message (string): A success message indicating that the folder information has been retrieved successfully.
  • isSuccess (boolean): A boolean value indicating whether the folder retrieval was successful or not.

Example:

{
  "folders": [
    {
      "id": 0,
      "name": "folder1"
    },
    {
      "id": 1,
      "name": "folder2"
    },
    {
      "id": 2,
      "name": "folder3"
    }
  ],
  "message": "Folder information retrieved successfully.",
  "isSuccess": true
}