Copyrights REST API
Use this REST API to manage copyright notices for a component.
Methods Supported:
GET
POST
GET Copyrights
Use this method to retrieve all copyrights for the specified component identifier.
GET /api/experimental/licenseLegalMetadata/{ownerType: application|organization}/{ownerId}/component/copyright
Example:
curl -u username:password 'http://localhost:8070/api/experimental/licenseLegalMetadata/application/client-frameworks/component/copyright?componentIdentifier=%7B%22format%22%3A%22pypi%22%2C%22coordinates%22%3A%7B%22extension%22%3A%22whl%22%2C%22name%22%3A%22anyio%22%2C%22qualifier%22%3A%22py3-none-any%22%2C%22version%22%3A%223.6.1%22%7D%7D' -H 'Accept: application/json, text/plain, */*'
The response contains all copyrights for the given component identifier.
GET Copyrights by Specifying the Copyright and Component Hash
Use this method to retrieve the copyrights for a component by specifying the copyright content hash and the component hash.
GET /api/experimental/licenseLegalMetadata/{ownerType: application|organization}/{ownerId}/component/{componentHash}/copyright/{copyrightContentHash}/context
Example:
curl -u username:password 'http://localhost:8070/api/experimental/licenseLegalMetadata/application/client-frameworks/component/87587d19947e80b27eb3/copyright/f3c18d01a26363baeae376bed2b985f94e90c5197374034d5d2e896b75837cc8/context?componentIdentifier=%7B%22format%22%3A%22pypi%22%2C%22coordinates%22%3A%7B%22extension%22%3A%22whl%22%2C%22name%22%3A%22anyio%22%2C%22qualifier%22%3A%22py3-none-any%22%2C%22version%22%3A%223.6.1%22%7D%7D&filePath=anyio-3.6.1.dist-info%2FLICENSE' -H 'Accept: application/json, text/plain, */*' -H 'Accept-Language: en-US,en;q=0.9,es;q=0.8'
The response contains all copyrights for the component, for the given copyright content hash and component hash.
GET All Filepaths of Copyrights
Use this method to retrieve all filepaths for files that contain the copyright text for the component, by specifying the component hash and the copyright content hash.
GET /api/experimental/licenseLegalMetadata/{ownerType: application|organization}/{ownerId}/component/{componentHash}/copyright/{copyrightContentHash}/filePaths
Example:
curl -u username:password 'http://localhost:8070/api/experimental/licenseLegalMetadata/application/client-frameworks/component/87587d19947e80b27eb3/copyright/f3c18d01a26363baeae376bed2b985f94e90c5197374034d5d2e896b75837cc8/filePaths?componentIdentifier=%7B%22format%22%3A%22pypi%22%2C%22coordinates%22%3A%7B%22extension%22%3A%22whl%22%2C%22name%22%3A%22anyio%22%2C%22qualifier%22%3A%22py3-none-any%22%2C%22version%22%3A%223.6.1%22%7D%7D&pageStart=0&pageLength=15' -H 'Accept: application/json, text/plain, */*'
The response contains the filepaths for all files containing copyrights for the given component hash and copyright content hash.
GET the Number of files Containing Copyright
Use this method to retrieve the number of files that contain the copyright, by specifying the copyright hash ID.
GET /api/experimental/licenseLegalMetadata/{ownerType: application|organization}/{ownerId}/component/{componentHash}/copyright/fileCount (com.sonatype.insight.brain.api.experimental.legal.ApiLicenseLegalResource)
Example:
curl -u username:password 'http://localhost:8070/api/experimental/licenseLegalMetadata/application/client-frameworks/component/87587d19947e80b27eb3/copyright/fileCount?componentIdentifier=%7B%22format%22%3A%22pypi%22%2C%22coordinates%22%3A%7B%22extension%22%3A%22whl%22%2C%22name%22%3A%22anyio%22%2C%22qualifier%22%3A%22py3-none-any%22%2C%22version%22%3A%223.6.1%22%7D%7D' -H 'Accept: application/json, text/plain, */*'
The response contains the number of files that contain the copyright identified by the copyright hash ID provided.
Add Copyrights for the Component
Use the POST method to add new copyrights text to a component by specifying the component identifier.
POST /api/experimental/licenseLegalMetadata/{ownerType: application|organization}/{ownerId}/component/copyright
Example:
curl -u username:password 'http://localhost:8070/api/experimental/licenseLegalMetadata/organization/ROOT_ORGANIZATION_ID/component/copyright' -H 'Accept: application/json, text/plain, */*' -H 'Content-Type: application/json' --data-raw '{"id":null,"componentIdentifier":{"format":"pypi","coordinates":{"extension":"whl","name":"anyio","qualifier":"py3-none-any","version":"3.6.1"}},"copyrightOverrides":[{"content":"Copyright (c) 2018 Alex Grönholm","id":null,"originalContentHash":"f3c18d01a26363baeae376bed2b985f94e90c5197374034d5d2e896b75837cc8","status":"enabled"},{"content":"Test copyright string.","id":null,"originalContentHash":null,"status":"enabled"}]}'