Documentation Powered by ReDoc

# HumHub - cFiles API (1.0.0)

Download OpenAPI specification:Download

E-mail: info@humhub.com License: AGPLv2

Welcome to the HumHub cFiles module API reference.

# Authentication

## Bearer

Security Scheme Type | JWT

## BasicAuth

Security Scheme Type | HTTP
HTTP Authorization Scheme | basic

# Directory

## Find all folders by content container

##### path Parameters

id required | integer The id of content container

##### query Parameters

page | string >= 0 The number of page of the result set.
limit | string [ 1 .. 50 ] Default: 20 The numbers of items to return per page.

### Responses

/api/v1/cfiles/folders/container/{id}

### Response samples

- 200

Content type
application/json
application/json
application/xml
`
{

- "total": 76,
- "page": 1,
- "results":
  [
  - {
    - "id": 4,
    - "title": "API directory",
    - "description": "API directory description",
    - "parent_folder_id": 1,
    - "type": null,
    - "created_at": "2021-04-08T10:42:21.203Z",
    - "created_by":
      {
      - "id": 14,
      - "guid": "cd081891-d2e2-40d5-84a4-b47309e71c80",
      - "display_name": "John Doe",
      - "url": "http://localhost/p/humhub/master/u/j.doe/"
      },
    - "content":
      {
      - "metadata":
        {
        - "id": 14,
        - "guid": "cd081891-d2e2-40d5-84a4-b47309e71c80",
        - "url": "http://localhost/p/humhub/master/content/perma?id=109",
        - "created_by":
          {
          - "id": 14,
          - "guid": "cd081891-d2e2-40d5-84a4-b47309e71c80",
          - "display_name": "John Doe",
          - "url": "http://localhost/p/humhub/master/u/j.doe/"
          },
        - "created_at": null,
        - "contentcontainer_id": 5,
        - "stream_channel": "default"
        },
      - "comments":
        {
        - "total": 55,
        - "latestComments":
          [
          - {
            - "id": 14,
            - "message": "Calvin Klein – Between love and madness lies obsession.",
            - "createdBy":
              {
              - "id": 14,
              - "guid": "cd081891-d2e2-40d5-84a4-b47309e71c80",
              - "display_name": "John Doe",
              - "url": "http://localhost/p/humhub/master/u/j.doe/"
              },
            - "createdAt": "2021-04-08T10:42:21.204Z"
            }
          ]
        },
      - "likes":
        {
        - "total": 35
        },
      - "files":
        {
        - "id": 14,
        - "guid": "bded6dc7-e6f4-417e-a638-b653525529ca",
        - "mime_type": "text/plain",
        - "size": 14353,
        - "file_name": "image.jpg",
        - "url": "http://localhost/p/humhub/master/file/file/download?guid=bded6dc7-e6f4-417e-a638-b653525529ca"
        },
      - "topics":
        {
        - "topic":
          [
          - null
          ]
        }
      }
    }
  ]

}`

## Create new directory

##### path Parameters

id required | integer The id of content container

##### Request Body schema: application/json

Directory information

target_id required | integer <int64>
required | object

### Responses

/api/v1/cfiles/folders/container/{id}

### Request samples

- Payload

Content type
application/json
`
{

- "target_id": 1,
- "Folder":
  {
  - "title": "API folder",
  - "description": "API folder description",
  - "visibility": 1
  }

}`

### Response samples

- 200
- 404
- 500

Content type
application/json
`
{

- "id": 4,
- "title": "API directory",
- "description": "API directory description",
- "parent_folder_id": 1,
- "type": null,
- "created_at": "2021-04-08T10:42:21.203Z",
- "created_by":
  {
  - "id": 14,
  - "guid": "cd081891-d2e2-40d5-84a4-b47309e71c80",
  - "display_name": "John Doe",
  - "url": "http://localhost/p/humhub/master/u/j.doe/"
  },
- "content":
  {
  - "metadata":
    {
    - "id": 14,
    - "guid": "cd081891-d2e2-40d5-84a4-b47309e71c80",
    - "url": "http://localhost/p/humhub/master/content/perma?id=109",
    - "created_by":
      {
      - "id": 14,
      - "guid": "cd081891-d2e2-40d5-84a4-b47309e71c80",
      - "display_name": "John Doe",
      - "url": "http://localhost/p/humhub/master/u/j.doe/"
      },
    - "created_at": null,
    - "contentcontainer_id": 5,
    - "stream_channel": "default"
    },
  - "comments":
    {
    - "total": 55,
    - "latestComments":
      [
      - {
        - "id": 14,
        - "message": "Calvin Klein – Between love and madness lies obsession.",
        - "createdBy":
          {
          - "id": 14,
          - "guid": "cd081891-d2e2-40d5-84a4-b47309e71c80",
          - "display_name": "John Doe",
          - "url": "http://localhost/p/humhub/master/u/j.doe/"
          },
        - "createdAt": "2021-04-08T10:42:21.204Z"
        }
      ]
    },
  - "likes":
    {
    - "total": 35
    },
  - "files":
    {
    - "id": 14,
    - "guid": "bded6dc7-e6f4-417e-a638-b653525529ca",
    - "mime_type": "text/plain",
    - "size": 14353,
    - "file_name": "image.jpg",
    - "url": "http://localhost/p/humhub/master/file/file/download?guid=bded6dc7-e6f4-417e-a638-b653525529ca"
    },
  - "topics":
    {
    - "topic":
      [
      - null
      ]
    }
  }

}`

## Get directory by id

##### path Parameters

id required | integer The id of directory

### Responses

/api/v1/cfiles/folder/{id}

### Response samples

- 200
- 404

Content type
application/json
`
{

- "id": 4,
- "title": "API directory",
- "description": "API directory description",
- "parent_folder_id": 1,
- "type": null,
- "created_at": "2021-04-08T10:42:21.203Z",
- "created_by":
  {
  - "id": 14,
  - "guid": "cd081891-d2e2-40d5-84a4-b47309e71c80",
  - "display_name": "John Doe",
  - "url": "http://localhost/p/humhub/master/u/j.doe/"
  },
- "content":
  {
  - "metadata":
    {
    - "id": 14,
    - "guid": "cd081891-d2e2-40d5-84a4-b47309e71c80",
    - "url": "http://localhost/p/humhub/master/content/perma?id=109",
    - "created_by":
      {
      - "id": 14,
      - "guid": "cd081891-d2e2-40d5-84a4-b47309e71c80",
      - "display_name": "John Doe",
      - "url": "http://localhost/p/humhub/master/u/j.doe/"
      },
    - "created_at": null,
    - "contentcontainer_id": 5,
    - "stream_channel": "default"
    },
  - "comments":
    {
    - "total": 55,
    - "latestComments":
      [
      - {
        - "id": 14,
        - "message": "Calvin Klein – Between love and madness lies obsession.",
        - "createdBy":
          {
          - "id": 14,
          - "guid": "cd081891-d2e2-40d5-84a4-b47309e71c80",
          - "display_name": "John Doe",
          - "url": "http://localhost/p/humhub/master/u/j.doe/"
          },
        - "createdAt": "2021-04-08T10:42:21.204Z"
        }
      ]
    },
  - "likes":
    {
    - "total": 35
    },
  - "files":
    {
    - "id": 14,
    - "guid": "bded6dc7-e6f4-417e-a638-b653525529ca",
    - "mime_type": "text/plain",
    - "size": 14353,
    - "file_name": "image.jpg",
    - "url": "http://localhost/p/humhub/master/file/file/download?guid=bded6dc7-e6f4-417e-a638-b653525529ca"
    },
  - "topics":
    {
    - "topic":
      [
      - null
      ]
    }
  }

}`

## Update directory by id

##### path Parameters

id required | integer The id of the directory

##### Request Body schema: application/json

Directory information

target_id required | integer <int64>
required | object

### Responses

/api/v1/cfiles/folder/{id}

### Request samples

- Payload

Content type
application/json
`
{

- "target_id": 1,
- "Folder":
  {
  - "title": "API folder",
  - "description": "API folder description",
  - "visibility": 1
  }

}`

### Response samples

- 200
- 404
- 500

Content type
application/json
`
{

- "id": 4,
- "title": "API directory",
- "description": "API directory description",
- "parent_folder_id": 1,
- "type": null,
- "created_at": "2021-04-08T10:42:21.203Z",
- "created_by":
  {
  - "id": 14,
  - "guid": "cd081891-d2e2-40d5-84a4-b47309e71c80",
  - "display_name": "John Doe",
  - "url": "http://localhost/p/humhub/master/u/j.doe/"
  },
- "content":
  {
  - "metadata":
    {
    - "id": 14,
    - "guid": "cd081891-d2e2-40d5-84a4-b47309e71c80",
    - "url": "http://localhost/p/humhub/master/content/perma?id=109",
    - "created_by":
      {
      - "id": 14,
      - "guid": "cd081891-d2e2-40d5-84a4-b47309e71c80",
      - "display_name": "John Doe",
      - "url": "http://localhost/p/humhub/master/u/j.doe/"
      },
    - "created_at": null,
    - "contentcontainer_id": 5,
    - "stream_channel": "default"
    },
  - "comments":
    {
    - "total": 55,
    - "latestComments":
      [
      - {
        - "id": 14,
        - "message": "Calvin Klein – Between love and madness lies obsession.",
        - "createdBy":
          {
          - "id": 14,
          - "guid": "cd081891-d2e2-40d5-84a4-b47309e71c80",
          - "display_name": "John Doe",
          - "url": "http://localhost/p/humhub/master/u/j.doe/"
          },
        - "createdAt": "2021-04-08T10:42:21.204Z"
        }
      ]
    },
  - "likes":
    {
    - "total": 35
    },
  - "files":
    {
    - "id": 14,
    - "guid": "bded6dc7-e6f4-417e-a638-b653525529ca",
    - "mime_type": "text/plain",
    - "size": 14353,
    - "file_name": "image.jpg",
    - "url": "http://localhost/p/humhub/master/file/file/download?guid=bded6dc7-e6f4-417e-a638-b653525529ca"
    },
  - "topics":
    {
    - "topic":
      [
      - null
      ]
    }
  }

}`

## Deletes a directory by id

##### path Parameters

id required | integer The id of directory

### Responses

/api/v1/cfiles/folder/{id}

### Response samples

- 200
- 404

Content type
application/json
`
{

- "code": 200,
- "message": "Selected items are successfully deleted!"

}`

# File

## Find all files by content container

##### path Parameters

id required | integer The id of content container

##### query Parameters

page | string >= 0 The number of page of the result set.
limit | string [ 1 .. 50 ] Default: 20 The numbers of items to return per page.

### Responses

/api/v1/cfiles/files/container/{id}

### Response samples

- 200

Content type
application/json
application/json
application/xml
`
{

- "total": 76,
- "page": 1,
- "results":
  [
  - {
    - "id": 4,
    - "description": "API directory description",
    - "parent_folder":
      {
      - "id": 4,
      - "title": "API directory",
      - "description": "API directory description"
      },
    - "created_at": "2021-04-08T10:42:21.203Z",
    - "created_by":
      {
      - "id": 14,
      - "guid": "cd081891-d2e2-40d5-84a4-b47309e71c80",
      - "display_name": "John Doe",
      - "url": "http://localhost/p/humhub/master/u/j.doe/"
      },
    - "content":
      {
      - "metadata":
        {
        - "id": 14,
        - "guid": "cd081891-d2e2-40d5-84a4-b47309e71c80",
        - "url": "http://localhost/p/humhub/master/content/perma?id=109",
        - "created_by":
          {
          - "id": 14,
          - "guid": "cd081891-d2e2-40d5-84a4-b47309e71c80",
          - "display_name": "John Doe",
          - "url": "http://localhost/p/humhub/master/u/j.doe/"
          },
        - "created_at": null,
        - "contentcontainer_id": 5,
        - "stream_channel": "default"
        },
      - "comments":
        {
        - "total": 55,
        - "latestComments":
          [
          - {
            - "id": 14,
            - "message": "Calvin Klein – Between love and madness lies obsession.",
            - "createdBy":
              {
              - "id": 14,
              - "guid": "cd081891-d2e2-40d5-84a4-b47309e71c80",
              - "display_name": "John Doe",
              - "url": "http://localhost/p/humhub/master/u/j.doe/"
              },
            - "createdAt": "2021-04-08T10:42:21.204Z"
            }
          ]
        },
      - "likes":
        {
        - "total": 35
        },
      - "files":
        {
        - "id": 14,
        - "guid": "bded6dc7-e6f4-417e-a638-b653525529ca",
        - "mime_type": "text/plain",
        - "size": 14353,
        - "file_name": "image.jpg",
        - "url": "http://localhost/p/humhub/master/file/file/download?guid=bded6dc7-e6f4-417e-a638-b653525529ca"
        },
      - "topics":
        {
        - "topic":
          [
          - null
          ]
        }
      }
    }
  ]

}`

## Upload files

##### path Parameters

id required | integer The id of content container

##### Request Body schema: application/x-www-form-urlencoded

folder_id required | integer <int64> Id of directory
files required | Array of file The files to upload.

### Responses

/api/v1/cfiles/files/container/{id}

### Response samples

- 200
- 404
- 500

Content type
application/json
`
{

- "code": 200,
- "message": "Files successfully uploaded!"

}`

## Get file info by id

##### path Parameters

id required | integer The id of file

### Responses

/api/v1/cfiles/file/{id}

### Response samples

- 200
- 404

Content type
application/json
`
{

- "id": 4,
- "description": "API directory description",
- "parent_folder":
  {
  - "id": 4,
  - "title": "API directory",
  - "description": "API directory description"
  },
- "created_at": "2021-04-08T10:42:21.203Z",
- "created_by":
  {
  - "id": 14,
  - "guid": "cd081891-d2e2-40d5-84a4-b47309e71c80",
  - "display_name": "John Doe",
  - "url": "http://localhost/p/humhub/master/u/j.doe/"
  },
- "content":
  {
  - "metadata":
    {
    - "id": 14,
    - "guid": "cd081891-d2e2-40d5-84a4-b47309e71c80",
    - "url": "http://localhost/p/humhub/master/content/perma?id=109",
    - "created_by":
      {
      - "id": 14,
      - "guid": "cd081891-d2e2-40d5-84a4-b47309e71c80",
      - "display_name": "John Doe",
      - "url": "http://localhost/p/humhub/master/u/j.doe/"
      },
    - "created_at": null,
    - "contentcontainer_id": 5,
    - "stream_channel": "default"
    },
  - "comments":
    {
    - "total": 55,
    - "latestComments":
      [
      - {
        - "id": 14,
        - "message": "Calvin Klein – Between love and madness lies obsession.",
        - "createdBy":
          {
          - "id": 14,
          - "guid": "cd081891-d2e2-40d5-84a4-b47309e71c80",
          - "display_name": "John Doe",
          - "url": "http://localhost/p/humhub/master/u/j.doe/"
          },
        - "createdAt": "2021-04-08T10:42:21.204Z"
        }
      ]
    },
  - "likes":
    {
    - "total": 35
    },
  - "files":
    {
    - "id": 14,
    - "guid": "bded6dc7-e6f4-417e-a638-b653525529ca",
    - "mime_type": "text/plain",
    - "size": 14353,
    - "file_name": "image.jpg",
    - "url": "http://localhost/p/humhub/master/file/file/download?guid=bded6dc7-e6f4-417e-a638-b653525529ca"
    },
  - "topics":
    {
    - "topic":
      [
      - null
      ]
    }
  }

}`

## Deletes a file by id

##### path Parameters

id required | integer The id of file

### Responses

/api/v1/cfiles/file/{id}

### Response samples

- 200
- 404

Content type
application/json
`
{

- "code": 200,
- "message": "Successfully deleted!"

}`

# Items Management

## Make items public

##### path Parameters

id required | integer The id of content container

##### Request Body schema: application/json

Array of items

selection required | Array of strings (Selection) Item id in format {type}_{id}

### Responses

/api/v1/cfiles/items/container/{id}/make-public

### Request samples

- Payload

Content type
application/json
`
{

- "selection":
  [
  - "folder_4",
  - "file_2"
  ]

}`

### Response samples

- 200
- 404
- 500

Content type
application/json
`
{

- "code": 200,
- "message": "Items successfully marked public!"

}`

## Make items private

##### path Parameters

id required | integer The id of content container

##### Request Body schema: application/json

Array of items

selection required | Array of strings (Selection) Item id in format {type}_{id}

### Responses

/api/v1/cfiles/items/container/{id}/make-private

### Request samples

- Payload

Content type
application/json
`
{

- "selection":
  [
  - "folder_4",
  - "file_2"
  ]

}`

### Response samples

- 200
- 404
- 500

Content type
application/json
`
{

- "code": 200,
- "message": "Items successfully marked private!"

}`

## Move items to another folder

##### path Parameters

id required | integer The id of content container

##### Request Body schema: application/json

Directory information

source_id required | integer <int64>
required | object
selection required | Array of strings (Selection) Item id in format {type}_{id}

### Responses

/api/v1/cfiles/items/container/{id}/move

### Request samples

- Payload

Content type
application/json
`
{

- "source_id": 14,
- "MoveForm":
  {
  - "destId": 3
  },
- "selection":
  [
  - "folder_4",
  - "file_2"
  ]

}`

### Response samples

- 200
- 404
- 500

Content type
application/json
`
{

- "code": 200,
- "message": "Items successfully moved."

}`

## Delete items from folder

##### path Parameters

id required | integer The id of content container

##### Request Body schema: application/json

Array of items

selection required | Array of strings (Selection) Item id in format {type}_{id}

### Responses

/api/v1/cfiles/items/container/{id}/delete

### Request samples

- Payload

Content type
application/json
`
{

- "selection":
  [
  - "folder_4",
  - "file_2"
  ]

}`

### Response samples

- 200
- 404
- 500

Content type
application/json
`
{

- "code": 200,
- "message": "Selected items are successfully deleted!"

}`