openapi: 3.1.0 info: title: FOSSology Admin User 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: User description: User management paths: /users: post: operationId: createUser tags: - User summary: Create a new user description: 'Create a new user ' requestBody: required: true content: application/json: schema: allOf: - $ref: '#/components/schemas/User' - type: object properties: user_pass: type: string defaultVisibility: type: string enum: - public - protected - private required: - name application/x-www-form-urlencoded: schema: allOf: - $ref: '#/components/schemas/User' - type: object properties: user_pass: type: string defaultVisibility: type: string enum: - public - protected - private required: - name responses: '201': description: User created successfully content: application/json: schema: $ref: '#/components/schemas/Info' '409': description: User with the same email or username already exists 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' get: operationId: getUsers tags: - User description: Get the registered users responses: '200': description: OK content: application/json: schema: type: array items: $ref: '#/components/schemas/User' default: $ref: '#/components/responses/defaultResponse' /users/{id}: parameters: - name: id required: true in: path schema: type: integer get: operationId: getUserById tags: - User summary: Get user by id description: 'Get one single user by id ' responses: '200': description: User with the given id content: application/json: schema: $ref: '#/components/schemas/User' default: $ref: '#/components/responses/defaultResponse' put: operationId: modifyUserById tags: - User summary: Edit user details by id description: 'Edit user details by id ' requestBody: required: true content: application/json: schema: allOf: - $ref: '#/components/schemas/User' - type: object properties: user_pass: type: string defaultFolderId: type: integer defaultVisibility: type: string enum: - public - protected - private application/x-www-form-urlencoded: schema: allOf: - $ref: '#/components/schemas/User' - type: object properties: user_pass: type: string defaultFolderId: type: integer defaultVisibility: type: string enum: - public - protected - private responses: '200': description: User updated successfully content: application/json: schema: $ref: '#/components/schemas/Info' '400': description: Missing or wrong parameters in request body content: application/json: schema: $ref: '#/components/schemas/Info' '403': description: The session owner is not an admin content: application/json: schema: $ref: '#/components/schemas/Info' '404': description: UserId doesn't exist content: application/json: schema: $ref: '#/components/schemas/Info' default: $ref: '#/components/responses/defaultResponse' delete: operationId: deleteUserById tags: - User summary: Delete user by id description: 'Delete a single user by id ' responses: '202': description: User will be deleted content: application/json: schema: $ref: '#/components/schemas/Info' default: $ref: '#/components/responses/defaultResponse' /users/self: get: operationId: getSelf tags: - User description: Get the information about logged in user responses: '200': description: OK content: application/json: schema: allOf: - $ref: '#/components/schemas/User' - type: object properties: default_group: type: string description: Default group of the user example: fossy default: $ref: '#/components/responses/defaultResponse' /users/tokens: post: operationId: createRestApiToken tags: - User summary: Create a new REST API Token description: 'Create a new REST API Token ' requestBody: required: true content: application/x-www-form-urlencoded: schema: $ref: '#/components/schemas/TokenRequest' responses: '201': description: Token created successfully content: application/json: schema: allOf: - $ref: '#/components/schemas/Info' - type: object properties: token: type: string example: eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJleHAiOjE2NTgwODI1OTksIm5iZiI6MTY1NzkwOTgwMCwianRpIjoiTXk0eiIsInNjb3BlIjoid3JpdGUifQ.Sl1acvN0GlCe7VUZJQX00u_vpfWrtfJlVYQ63FBkzP4 '400': description: Following parameters are required in the request body -- token_name,token_scope,token_expire content: application/json: schema: $ref: '#/components/schemas/Info' default: $ref: '#/components/responses/defaultResponse' /users/tokens/{type}: parameters: - name: type required: true in: path schema: type: string enum: - active - expired get: operationId: getTokensByType tags: - User summary: Get all the REST API tokens (active | expired) description: 'Get all the REST API tokens (active | expired) ' responses: '200': description: Success content: application/json: schema: allOf: - $ref: '#/components/schemas/Info' - type: object properties: active_tokens: $ref: '#/components/schemas/Token' '400': description: Invalid request 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 put: operationId: updatePermissionByGroupIdAndUserId tags: - User 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' components: schemas: TokenRequest: type: object properties: token_name: type: string maxLength: 40 description: Friendly name of the token token_scope: type: string enum: - read - write description: The scope of the token. token_expire: type: string format: date description: Date when the token must expire (default max 30 days). required: - username - password - token_name - token_scope - token_expire Token: type: object properties: id: type: string description: Token Id token_name: type: string description: Name of the Token created: type: string format: date description: Denotes when the token was created example: 2022-07-11 token_expire: type: string format: date description: Denotes when the token was created example: 2022-07-11 scope: type: string enum: - read - write description: Scope of the token token: type: string description: Scope of the token example: eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJleHAiOjE2NTg5NDY1OTksIm5iZiI6MTY1NzkwOTgwMCwianRpIjoiTnk0eiIsInNjb3BlIjoid3JpdGUifQ.Yqwdt7Fzx-Qw3megYix_OYu1mqBOoz4Rrc1cgJasmJA 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 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'