openapi: 3.1.0 info: title: FOSSology Admin License 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: License description: License and obligation management paths: /obligations/import-csv: post: operationId: importObligationCsv tags: - License summary: Import an obligation csv file description: 'Import an obligation csv file ' requestBody: description: Information about delimiters, inclosure and csv file. required: true content: multipart/form-data: schema: type: object properties: enclosure: type: string description: Enclosure for string in CSV default: '"' delimiter: type: string description: Delimiters for fields in CSV default: ',' file_input: type: string format: binary description: CSV to be imported required: - file_input responses: '400': description: Validation Error content: application/json: schema: $ref: '#/components/schemas/Info' '200': description: Successfully imported content: application/json: schema: $ref: '#/components/schemas/Info' default: $ref: '#/components/responses/defaultResponse' /obligations/export-csv: get: operationId: exportLicenseObligations parameters: - name: id description: Obligation id to export, 0 for all in: query required: false schema: type: integer tags: - License summary: Export a csv obligation list description: 'Export a csv license obligation list ' responses: '200': description: Successfully exported content: text/plain: schema: type: string format: binary '403': description: Route is not accessible content: application/json: schema: $ref: '#/components/schemas/Info' default: $ref: '#/components/responses/defaultResponse' /obligations/import-json: post: operationId: importObligationsFromJSON tags: - License summary: Import an obligation json file description: 'Import an obligation json file ' requestBody: description: Include the JSON file required: true content: multipart/form-data: schema: type: object properties: fileInput: type: string format: binary description: JSON to be imported required: - fileInput responses: '400': description: Validation Error content: application/json: schema: $ref: '#/components/schemas/Info' '200': description: Successfully imported content: application/json: schema: $ref: '#/components/schemas/Info' default: $ref: '#/components/responses/defaultResponse' /obligations/export-json: get: operationId: exportObligationsToJSON parameters: - name: id description: Obligation id to export, 0 for all in: query required: false schema: type: integer tags: - License summary: Export a json obligation list description: 'Export a json license obligation list ' responses: '200': description: Successfully exported content: text/json: schema: type: string format: binary '403': description: Route is not accessible content: application/json: schema: $ref: '#/components/schemas/Info' default: $ref: '#/components/responses/defaultResponse' /uploads/{id}/item/{itemId}/view: parameters: - name: id required: true description: Id of the upload in: path schema: type: integer - name: itemId required: true description: Id of the item in: path schema: type: integer get: operationId: viewTheContentOfTheFile tags: - License summary: Get the contents of the file description: Returns the contents of a specific file responses: '200': description: Get contents content: text/plain: schema: type: string '404': description: Upload or Item does not exist content: application/json: schema: type: array items: $ref: '#/components/schemas/Info' '500': description: Internal Server Error. content: application/json: schema: $ref: '#/components/schemas/Info' default: $ref: '#/components/responses/defaultResponse' /license: parameters: - name: groupName description: The group name to chose in: header required: false schema: type: string description: Group name, from last login if not provided get: operationId: getLicenses tags: - License parameters: - name: page description: Page number to fetch in: header required: false schema: type: integer default: 1 - name: limit description: Limits of responses per request in: header required: false schema: type: integer minimum: 1 default: 100 - name: active description: Get only active licenses in: header required: false schema: type: boolean default: false - name: kind description: Which kind of licenses to get. in: query required: false schema: type: string enum: - candidate - main - all default: all summary: Get all license from the database description: 'Get a list of available licenses (filtered by kind or status) ' responses: '200': description: All licenses from database headers: X-Total-Pages: description: Total number of pages which can be fetched schema: type: integer content: application/json: schema: type: array items: allOf: - type: object properties: id: type: integer description: Id key example: 125 - $ref: '#/components/schemas/License' default: $ref: '#/components/responses/defaultResponse' post: operationId: createLicense tags: - License summary: Create a new license description: 'Add a new license to the database ' requestBody: description: Information about new license required: true content: application/json: schema: allOf: - $ref: '#/components/schemas/License' - type: object properties: mergeRequest: description: Open a merge request for candidate license? type: boolean default: false required: - shortName responses: '201': description: License added successfully content: application/json: schema: $ref: '#/components/schemas/Info' '409': description: License with same name or text already exists content: application/json: schema: $ref: '#/components/schemas/Info' default: $ref: '#/components/responses/defaultResponse' /license/import-csv: post: operationId: importLicense tags: - License summary: Import a csv license description: 'Import a csv license to the database ' requestBody: description: Information about delimiters, inclosure and csv file. required: true content: multipart/form-data: schema: type: object properties: enclosure: type: string description: Enclosure for string in CSV default: '"' delimiter: type: string description: Delimiters for fields in CSV default: ',' file_input: type: string format: binary description: CSV to be imported required: - file_input responses: '400': description: Validation Error content: application/json: schema: $ref: '#/components/schemas/Info' '200': description: Successfully imported content: application/json: schema: $ref: '#/components/schemas/Info' default: $ref: '#/components/responses/defaultResponse' /license/export-csv: get: operationId: exportLicense parameters: - name: id description: License id to export, 0 for all in: query required: false schema: type: integer tags: - License summary: Export a csv license description: 'Export a csv license ' responses: '200': description: Successfully exported content: text/csv: schema: type: string format: binary '403': description: Route is not accessible content: application/json: schema: $ref: '#/components/schemas/Info' default: $ref: '#/components/responses/defaultResponse' /license/import-json: post: operationId: handleImportLicense tags: - License summary: Import a json license description: 'Import a json license to the database ' requestBody: description: Include the JSON file required: true content: multipart/form-data: schema: type: object properties: fileInput: type: string format: binary description: JSON to be imported required: - fileInput responses: '400': description: Validation Error content: application/json: schema: $ref: '#/components/schemas/Info' '200': description: Successfully imported content: application/json: schema: $ref: '#/components/schemas/Info' default: $ref: '#/components/responses/defaultResponse' /license/export-json: get: operationId: exportAdminLicenseToJSON parameters: - name: id description: License id to export, 0 for all in: query required: false schema: type: integer tags: - License summary: Export a json license description: 'Export a json license ' responses: '200': description: Successfully exported content: text/csv: schema: type: string format: binary '403': description: Route is not accessible content: application/json: schema: $ref: '#/components/schemas/Info' default: $ref: '#/components/responses/defaultResponse' /license/{shortname}: parameters: - name: shortname in: path required: true description: Shortname of the license schema: type: string - name: groupName description: The group name to chose in: header required: false schema: type: string description: Group name, from last login if not provided get: operationId: getLicenseByShortname tags: - License summary: Get a specific license description: 'Get information about a specific license ' responses: '200': description: License content: application/json: schema: allOf: - type: object properties: id: type: integer description: Id key example: 125 - $ref: '#/components/schemas/License' - type: object properties: obligations: description: Obligations associated with the license type: array items: $ref: '#/components/schemas/Obligation' '404': description: License not found content: application/json: schema: $ref: '#/components/schemas/Info' default: $ref: '#/components/responses/defaultResponse' patch: operationId: updateLicenseByShortname tags: - License summary: Update a license description: 'Update information about a given license ' requestBody: description: Information to be updated required: true content: application/json: schema: type: object description: Set the properties to be updated properties: fullName: description: New fullname type: string nullable: true example: Updated license name text: description: New license text type: string nullable: true example: Updated and corrected license text url: description: New URL for license type: string nullable: true example: https://opensource.org/licenses/MIT risk: description: New risk value type: integer nullable: true example: 2 responses: '200': description: License added successfully content: application/json: schema: $ref: '#/components/schemas/Info' default: $ref: '#/components/responses/defaultResponse' /license/admincandidates: get: operationId: getAdminLicenseCandidates tags: - License summary: Get license Candidates for admin view description: 'Get a list of license candidates from the database. ' responses: '200': description: Request is successful content: application/json: schema: type: array items: $ref: '#/components/schemas/LicenseCandidate' '500': description: Internal server error with details content: application/json: schema: $ref: '#/components/schemas/Info' default: $ref: '#/components/responses/defaultResponse' /license/admincandidates/{id}: parameters: - name: id required: true description: Id of the license-candidate in: path schema: type: integer delete: operationId: deleteByLicenseCandidateId tags: - License summary: Delete license candidate by id. description: 'Delete a single admin-license-candidate by the given id. ' responses: '202': description: License candidate will be deleted. content: application/json: schema: $ref: '#/components/schemas/Info' '403': description: Validation error. content: application/json: schema: $ref: '#/components/schemas/Info' '500': description: Internal server error. content: application/json: schema: $ref: '#/components/schemas/Info' default: $ref: '#/components/responses/defaultResponse' /license/adminacknowledgements: get: operationId: getAdminLicenseAcknowledgements tags: - License summary: Get all admin license acknowledgements description: 'Get a list of the admin license acknowledgements ' responses: '200': description: Request is successful content: application/json: schema: type: array items: $ref: '#/components/schemas/AdminLicenseAcknowledgement' '500': description: Internal server error with details content: application/json: schema: $ref: '#/components/schemas/Info' default: $ref: '#/components/responses/defaultResponse' put: operationId: mutateAdminLicenseAcknowledgement tags: - License summary: Add, Edit, Enable & Disable description: 'Add, edit and toggle admin-license acknowledgement ' requestBody: required: true content: application/json: schema: type: array items: $ref: '#/components/schemas/MutateAdminAcknowledgement' responses: '200': description: Request is successful content: application/json: schema: type: array items: $ref: '#/components/schemas/Info' '500': description: Internal server error with details content: application/json: schema: $ref: '#/components/schemas/Info' default: $ref: '#/components/responses/defaultResponse' /license/stdcomments: get: operationId: getAllStandardLicenseComments tags: - License summary: Get all standard license comments description: 'Get a list of all standard license comments. ' responses: '200': description: Request is successful content: application/json: schema: type: array items: $ref: '#/components/schemas/StandardComment' default: $ref: '#/components/responses/defaultResponse' put: operationId: mutateStdComments tags: - License summary: Add, Edit, Enable & Disable description: 'Add, edit and toggle standard comments ' requestBody: required: true content: application/json: schema: type: array items: $ref: '#/components/schemas/MutateStdComment' responses: '200': description: Request is successful content: application/json: schema: type: array items: $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' /license/verify/{shortname}: parameters: - name: shortname in: path required: true description: Shortname of the license to be verified schema: type: string put: operationId: verifyLicense tags: - License summary: Verify a license as new or variant description: 'Verify a license as new or variant of another license ' requestBody: description: The shortname of the parent license | Same name if it's to be verified as a new license required: true content: application/json: schema: type: object properties: parentShortname: description: Shortname of the parent license type: string example: MIT responses: '200': description: License verified successfully content: application/json: schema: $ref: '#/components/schemas/Info' '400': description: Validation error. content: application/json: schema: $ref: '#/components/schemas/Info' '404': description: Given License not found. content: application/json: schema: $ref: '#/components/schemas/Info' '500': description: Internal server error. content: application/json: schema: $ref: '#/components/schemas/Info' default: $ref: '#/components/responses/defaultResponse' /license/merge/{shortname}: parameters: - name: shortname in: path required: true description: Shortname of the license to be merged schema: type: string put: operationId: mergeLicense tags: - License summary: Merge a license with another description: 'Merge a license to another existing license ' requestBody: description: The shortname of the parent license to be merged into required: true content: application/json: schema: type: object properties: parentShortname: description: Shortname of the parent license type: string example: MIT responses: '200': description: License merged successfully content: application/json: schema: $ref: '#/components/schemas/Info' '400': description: Validation error. content: application/json: schema: $ref: '#/components/schemas/Info' '404': description: Given License not found. content: application/json: schema: $ref: '#/components/schemas/Info' '500': description: Internal server error. content: application/json: schema: $ref: '#/components/schemas/Info' default: $ref: '#/components/responses/defaultResponse' /license/suggest: post: operationId: getSuggestedLicense tags: - License summary: Get suggested license by reference text. description: 'Get a single suggested license by the given reference text. ' requestBody: description: Reference text to get suggested license required: true content: application/json: schema: type: object properties: referenceText: description: Reference text to get suggested license type: string example: According to MIT license, add some modifications responses: '200': description: Request is successful content: application/json: schema: $ref: '#/components/schemas/GetSuggestedLicense' '403': description: Validation error. content: application/json: schema: $ref: '#/components/schemas/Info' '500': description: Internal server error. content: application/json: schema: $ref: '#/components/schemas/Info' default: $ref: '#/components/responses/defaultResponse' components: schemas: StandardComment: type: object properties: id: type: integer example: 2 description: The primary key of the comment. name: type: string example: firstComment description: The name of the comment. comment: type: string example: The comment's text description: The text content of the comment. is_enabled: type: boolean example: true description: Indicates whether the comment is enabled or not. HighlightInfo: type: object properties: start: type: integer description: Start position of the highlight in file example: 68 end: type: integer description: End position of the highlight in file example: 70 type: type: string description: Type of highlight enum: - M - MC - MA - MD - S - K - B - C - U - E - A - I - X - KW - any shortName: type: string description: License shortname example: MIT refStart: type: integer description: Start of monk diff highlight (relative) example: 0 refEnd: type: integer description: End of monk diff highlight (relative) example: 53 infoText: type: string description: Tooltip text example: 'MIT: ''MIT License Copyright (c) ''' htmlElement: type: string MutateStdComment: type: object properties: id: type: integer description: 'The ID of the standard comment. Required if update is TRUE. ' example: 2 name: type: string description: 'The name of the standard comment. Required if update is FALSE. ' example: commentName comment: type: string description: 'The standard comment text. Required if update is FALSE. ' example: comment text toggle: type: boolean description: A boolean indicating the toggle state. example: true update: type: boolean description: 'A boolean indicating if an update is needed. If TRUE, update the given standard comment. if FALSE, add new standard comment. ' example: true MutateAdminAcknowledgement: type: object properties: id: type: integer description: 'The ID of the acknowledgement. Required if update is TRUE. ' example: 2 name: type: string description: 'The name of the acknowledgement. Not required if update is TRUE and toggle is set. ' example: ackName ack: type: string description: 'The acknowledgement text. Not required if update is TRUE and toggle is set. ' example: acknowledgement text toggle: type: boolean description: A boolean indicating the toggle state. example: true update: type: boolean description: 'A boolean indicating if an update is needed. If true, update the given admin acknowledgement. if false, add new admin acknowledgement. ' example: true GetSuggestedLicense: type: object properties: id: type: integer description: The primary key of the suggested license. example: 1329 spdxName: type: string description: The SPDX identifier of the suggested license. example: LicenseRef-fossology-testmerge shortname: type: string description: The short name of the suggested license. example: MIT fullname: type: string description: The full name of the suggested license. example: MIT license text: type: string description: The text content of the suggested license. example: "Copyright (c) 2002 by AUTHOR PROFESSIONAL IDENTIFICATION * URL \"PROMOTIONAL SLOGAN FOR AUTHOR'S PROFESSIONAL PRACTICE\"\r\n" url: type: string description: The URL associated with the suggested license. example: https://www.google.com/ notes: type: string description: Additional notes or comments about the suggested license. example: public notes risk: type: integer description: The risk level associated with the suggested license. example: 2 highlights: type: array items: $ref: '#/components/schemas/HighlightInfo' AdminLicenseAcknowledgement: type: object properties: id: type: integer description: The primary key of the AdminAcknowledgement example: 2 name: type: string description: The name of the AdminAcknowledgement example: ackupdated acknowledgement: type: string description: The acknowledgement text of the AdminAcknowledgement example: updated Ack text is_enabled: type: boolean description: Indicates if the AdminAcknowledgement is enabled example: true License: description: License from the database type: object properties: shortName: description: Short name type: string example: MIT fullName: description: Full name type: string example: MIT License text: description: License text type: string example: MIT License Copyright (c) ... url: description: URL of the license text type: string example: https://opensource.org/licenses/MIT risk: description: Risk level type: integer nullable: true example: 3 isCandidate: description: Is the license a candidate? type: boolean 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 LicenseCandidate: type: object properties: id: type: integer description: ID of the license-candidate. shortname: type: string description: shortname of the license-candidate. spdxid: type: string description: SPDX ID of the license-candiate. fullname: type: string description: fullname of the license-candidate. text: type: string description: text of the license-candidate. group_name: type: string description: group_name of the license-candidate. group_id: type: integer description: group_id of the license-candidate. Obligation: description: Obligation information type: object properties: id: description: Id key type: integer example: 126 topic: description: Obligation topic type: string example: Should preserve notice type: description: Type of obligation type: string example: Obligation text: description: Obligation text type: string example: All notices from the package should be preserved. classification: description: 'Level of attention this obligation should raise in the clearing process ' type: string enum: - green - white - yellow - red comment: description: Comments for the obligation type: string nullable: true example: Please respect the obligation 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'