Skip to main content

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 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.

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"}]}'