FOSSology Folders API

Folder management

Documentation

Specifications

Schemas & Data

Other Resources

OpenAPI Specification

fossology-folders-api-openapi.yml Raw ↑
openapi: 3.1.0
info:
  title: FOSSology Admin Folders API
  description: Automate your fossology instance using REST API
  version: 1.6.2
  contact:
    email: fossology@fossology.org
  license:
    name: GPL-2.0-only
    url: https://github.com/fossology/fossology/blob/master/LICENSE
servers:
- url: http://localhost/repo/api/v1
  description: Localhost instance
- url: http://localhost/repo/api/v2
  description: Localhost instance (Version 2)
security:
- bearerAuth: []
- oauth: []
tags:
- name: Folders
  description: Folder management
paths:
  /folders:
    parameters:
    - name: groupName
      description: The group name to chose while accessing folders
      in: header
      required: false
      schema:
        type: string
        description: Group name, from last login if not provided
    get:
      operationId: getFolders
      tags:
      - Folders
      summary: Get the list of accessible folders
      description: 'Get all folders or from a specific group

        '
      responses:
        '200':
          description: List of folders
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/Folder'
        default:
          $ref: '#/components/responses/defaultResponse'
    post:
      operationId: createFolder
      tags:
      - Folders
      summary: Create a new folder
      description: 'Create a new child folder with optional description

        '
      parameters:
      - name: parentFolder
        in: header
        required: true
        description: Parent folder for the new folder
        schema:
          type: integer
      - name: folderName
        in: header
        required: true
        description: Name of the new folder
        schema:
          type: string
      - name: folderDescription
        in: header
        required: false
        description: Description of the new folder
        schema:
          type: string
      responses:
        '200':
          description: Folder with the same name already exists under the same parent
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Info'
        '201':
          description: Folder is created with new folder id in message
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Info'
        default:
          $ref: '#/components/responses/defaultResponse'
  /folders/{id}:
    parameters:
    - name: id
      in: path
      required: true
      description: ID of the folder
      schema:
        type: integer
    - name: groupName
      description: The group name to chose while accessing the folder
      in: header
      required: false
      schema:
        type: string
        description: Group name, from last login if not provided
    get:
      operationId: getFolderById
      tags:
      - Folders
      summary: Get a single folder details
      description: Get a single folder by id
      responses:
        '200':
          description: Details of the required folder
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Folder'
        default:
          $ref: '#/components/responses/defaultResponse'
    delete:
      operationId: deleteFolderById
      tags:
      - Folders
      summary: Delete a folder
      description: 'Schedule a folder deletion

        '
      responses:
        '202':
          description: Folder scheduled to be deleted
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Info'
        default:
          $ref: '#/components/responses/defaultResponse'
    patch:
      operationId: patchFolderById
      tags:
      - Folders
      parameters:
      - name: name
        in: header
        required: false
        description: New name of the folder
        schema:
          type: string
      - name: description
        in: header
        required: false
        description: New description of the folder
        schema:
          type: string
      summary: Edit a folder's description
      description: 'Change a folder''s name and/or description

        '
      responses:
        '200':
          description: Folder is updated
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Info'
        default:
          $ref: '#/components/responses/defaultResponse'
    put:
      operationId: moveFolderById
      tags:
      - Folders
      parameters:
      - name: parent
        in: header
        required: true
        description: New parent folder id
        schema:
          type: integer
      - name: action
        in: header
        required: true
        description: Action to be performed
        schema:
          type: string
          enum:
          - copy
          - move
      summary: Copy/Move a folder
      description: 'Copy or move a folder by id

        '
      responses:
        '202':
          description: Folder will be copied/moved
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Info'
        default:
          $ref: '#/components/responses/defaultResponse'
  /folders/contents/{contentId}/unlink:
    parameters:
    - name: contentId
      in: path
      required: true
      description: ID of the content
      schema:
        type: integer
    put:
      operationId: unlinkContent
      tags:
      - Folders
      summary: Unlink a content from a folder
      description: Unlink a content from a folder
      responses:
        '200':
          description: Content is unlinked from the folder
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Info'
        '404':
          description: Folder content does not exist
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Info'
        default:
          $ref: '#/components/responses/defaultResponse'
  /folders/{id}/contents:
    parameters:
    - name: id
      in: path
      required: true
      description: ID of the folder
      schema:
        type: integer
    get:
      operationId: getAllFolderContents
      tags:
      - Folders
      summary: Get all contents of a folder
      description: Get all contents of a folder by id
      responses:
        '200':
          description: Contents of the given folder
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/GetFolderContent'
        '403':
          description: Folder is not accessible
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Info'
        '404':
          description: Folder does not exist
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Info'
        default:
          $ref: '#/components/responses/defaultResponse'
  /folders/{id}/contents/unlinkable:
    parameters:
    - name: id
      in: path
      required: true
      description: ID of the folder
      schema:
        type: integer
    get:
      operationId: getUnlinkableContents
      tags:
      - Folders
      summary: Get contents of a folder which can be unlinked
      description: Get unlinkable contents of a folder by id. These contents are copied.
      responses:
        '200':
          description: Unlinkable contents of the given folder
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/GetFolderContent'
        '403':
          description: Folder is not accessible
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Info'
        '404':
          description: Folder does not exist
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Info'
        default:
          $ref: '#/components/responses/defaultResponse'
components:
  schemas:
    Info:
      type: object
      properties:
        code:
          type: integer
          description: HTTP status code
          example: 200
        message:
          type: string
          description: Message in the info
        type:
          type: string
          enum:
          - INFO
          - ERROR
          description: Denotes if info was created on error
    Folder:
      type: object
      properties:
        id:
          type: integer
          description: Id of the folder.
        name:
          type: string
          description: Name of the folder.
        description:
          type: string
          description: Description of the folder.
        parent:
          type: integer
          description: Id of the parent folder (if any, null otherwise).
    GetFolderContent:
      type: object
      properties:
        id:
          type: integer
          description: Id of the folder content.
        content:
          type: string
          description: Content of the folder.
        removable:
          type: boolean
          description: Is the folder removable.
  responses:
    defaultResponse:
      description: Some error occurred. Check the "message"
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Info'
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      bearerFormat: JWT
      description: Token from FOSSology
    oauth:
      description: Machine-2-Machine communication from oauth
      type: oauth2
      flows:
        clientCredentials:
          tokenUrl: https://api.example.com/oauth2/authorize
          scopes: {}
externalDocs:
  description: Basic guide
  url: https://github.com/fossology/fossology/wiki/FOSSology-REST-API
x-reuse:
- - name: id
    required: true
    description: Upload Id
    in: path
    schema:
      type: integer
  - name: itemId
    required: true
    description: UploadTree ID (available via /uploads/{id}/topitem & /uploads/{id}/item/{itemId}/tree/view)
    in: path
    schema:
      type: integer
  - name: status
    required: true
    in: query
    description: Status of the CX
    schema:
      type: string
      enum:
      - active
      - inactive
  - name: limit
    description: Limits of responses per request
    required: false
    in: header
    schema:
      type: integer
      default: 100
      minimum: 1
      maximum: 1000
  - name: page
    description: Page number for responses
    required: false
    in: header
    schema:
      type: integer
      default: 1
      minimum: 1
- - name: id
    required: true
    description: Upload ID
    in: path
    schema:
      type: integer
  - name: itemId
    required: true
    description: Upload tree ID
    in: path
    schema:
      type: integer
  - name: hash
    required: true
    description: CX hash
    in: path
    schema:
      type: string
- '200':
    description: OK
    headers:
      X-Total-Pages:
        description: Total number of pages which can be generated based on limit
        schema:
          type: integer
    content:
      application/json:
        schema:
          type: array
          items:
            $ref: '#/components/schemas/GetFileCopyrights'
  '400':
    description: Bad Request. 'upload' is a required query param
    content:
      application/json:
        schema:
          $ref: '#/components/schemas/Info'
  default:
    $ref: '#/components/responses/defaultResponse'
- '200':
    description: OK
    content:
      application/json:
        schema:
          $ref: '#/components/schemas/Info'
  '403':
    description: Access denied
    content:
      application/json:
        schema:
          $ref: '#/components/schemas/Info'
  default:
    $ref: '#/components/responses/defaultResponse'
- description: Updated text
  required: true
  content:
    application/json:
      schema:
        $ref: '#/components/schemas/SetCopyrightInfo'