FOSSology Groups API

User group management

Documentation

Specifications

Schemas & Data

Other Resources

OpenAPI Specification

fossology-groups-api-openapi.yml Raw ↑
openapi: 3.1.0
info:
  title: FOSSology Admin Groups 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: Groups
  description: User group management
paths:
  /groups:
    get:
      operationId: getGroups
      tags:
      - Groups
      summary: Get the list of groups
      description: 'Returns accessible groups for a user, all groups for an admin

        '
      responses:
        '200':
          description: List of groups
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/Group'
        default:
          $ref: '#/components/responses/defaultResponse'
    post:
      operationId: createGroup
      tags:
      - Groups
      summary: Create a new group
      description: 'Create a new user group

        '
      parameters:
      - name: name
        in: header
        required: true
        description: Name of the new group
        schema:
          type: string
      responses:
        '200':
          description: Group has been added
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Info'
        '400':
          description: Group already exists, failed to create group or no group name provided
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Info'
        '500':
          description: Internal server error with details
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Info'
        default:
          $ref: '#/components/responses/defaultResponse'
  /groups/{id}:
    parameters:
    - name: id
      required: true
      description: Id of the group
      in: path
      schema:
        type: integer
    delete:
      operationId: deleteGroupById
      tags:
      - Groups
      summary: Delete group by id
      description: 'Deletes a single group by id.

        '
      responses:
        '202':
          description: User group will be deleted
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Info'
        default:
          $ref: '#/components/responses/defaultResponse'
  /groups/{id}/user/{userId}:
    parameters:
    - name: id
      required: true
      description: Id of the group
      in: path
      schema:
        type: integer
    - name: userId
      required: true
      description: user id of the member
      in: path
      schema:
        type: integer
    delete:
      operationId: deleteGroupMemberByGroupIdAndUserId
      tags:
      - Groups
      summary: Delete group member by groupId and userId
      description: 'Deletes a single group member by groupId and userId

        '
      responses:
        '200':
          description: User will be removed from group.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Info'
        '404':
          description: Not found Error.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Info'
        '400':
          description: Validation based error.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Info'
        '500':
          description: Internal server error with details.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Info'
        default:
          $ref: '#/components/responses/defaultResponse'
    post:
      operationId: addMember
      tags:
      - Groups
      summary: Add user to a group
      description: 'add a new user to group

        '
      requestBody:
        description: Request options
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/AddMember'
      responses:
        '200':
          description: User has been added to group
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Info'
        '400':
          description: Validation error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Info'
        '500':
          description: Internal server error with details
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Info'
        default:
          $ref: '#/components/responses/defaultResponse'
    put:
      operationId: updatePermissionByGroupIdAndUserId
      tags:
      - Groups
      summary: Update Permission
      description: 'Update User''s permission in group.

        '
      requestBody:
        description: Value of the new permission
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/NewGroupPermission'
          application/x-www-form-urlencoded:
            schema:
              $ref: '#/components/schemas/NewGroupPermission'
      responses:
        '202':
          description: User's permission will be updated.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Info'
        '404':
          description: Group or user doesn't exist.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Info'
        '400':
          description: Validation Error.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Info'
        '500':
          description: Internal server error with details
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Info'
        default:
          $ref: '#/components/responses/defaultResponse'
  /groups/deletable:
    get:
      operationId: deletableGroups
      tags:
      - Groups
      summary: Give a list of deletable groups
      description: 'Return a list of the groups which it is possible to delete.

        '
      responses:
        '200':
          description: List of groups
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/Group'
        default:
          $ref: '#/components/responses/defaultResponse'
  /groups/{id}/members:
    parameters:
    - name: id
      in: path
      required: true
      description: ID of the group
      schema:
        type: integer
    get:
      operationId: getGroupUsersWithRoles
      tags:
      - Groups
      summary: Get the users with their roles from a group
      description: 'Returns accessible objects of users with roles from the group

        '
      responses:
        '200':
          description: List of group-user-member
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/UserGroupMember'
        default:
          $ref: '#/components/responses/defaultResponse'
components:
  schemas:
    Group:
      description: Group object
      type: object
      properties:
        id:
          description: Id key
          type: integer
          example: 126
        name:
          description: Name of a group
          type: string
          example: Main group
    AddMember:
      description: UserMember options
      type: object
      properties:
        perm:
          type: integer
          description: Default permission of the new member.
          nullable: false
          minimum: 0
          maximum: 2
          example: 0
    Analysis:
      type: object
      properties:
        bucket:
          type: boolean
          description: Should bucket analysis be run on this upload
        copyright_email_author:
          type: boolean
          description: Should Copyright/Email/URL/Author Analysis be run on this upload.
        ecc:
          type: boolean
          description: Should ECC Analysis be run on this upload.
        patent:
          type: boolean
          description: Should IPRA Analysis be run on this upload.
        keyword:
          type: boolean
          description: Should keyword Analysis be run on this upload.
        mime:
          type: boolean
          description: Should MIME Analysis be run on this upload.
        monk:
          type: boolean
          description: Should Monk Analysis be run on this upload.
        nomos:
          type: boolean
          description: Should Nomos Analysis be run on this upload.
        ojo:
          type: boolean
          description: Should OJO Analysis be run on this upload.
        package:
          type: boolean
          description: Should Package Analysis be run on this upload.
        reso:
          type: boolean
          description: Should REUSE.Software Analysis be run on this upload.
        heritage:
          type: boolean
          description: Should Software Heritage Analysis be run on this upload.
        compatibility:
          type: boolean
          description: Should Compatibility Analysis be run on this upload.
    NewGroupPermission:
      description: User Group permission update
      type: object
      properties:
        perm:
          type: integer
          description: 'New user permission in the group.

            0: User

            1: Admin

            2: Advisor

            '
          minimum: 0
          maximum: 2
    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
    User:
      type: object
      properties:
        id:
          type: integer
          description: ID of the user
        name:
          type: string
          description: Unique username
        description:
          type: string
          description: Description of the user
        email:
          type: string
          description: Email of the user, needs to be unique and is required
        accessLevel:
          type: string
          enum:
          - none
          - read_only
          - read_write
          - clearing_admin
          - admin
        rootFolderId:
          type: number
          format: int
          description: root folder id of the user
        emailNotification:
          type: boolean
          description: enable email notification when upload scan completes
        defaultGroup:
          type: integer
          description: Default group id of the user
        agents:
          $ref: '#/components/schemas/Analysis'
        defaultBucketpool:
          description: Default bucket pool id
          type: integer
          nullable: true
      required:
      - id
    UserGroupMember:
      type: object
      properties:
        user:
          $ref: '#/components/schemas/User'
        group_perm:
          type: integer
          description: Permission of the user in the group.
          example: 1
  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'