- 17 May 2024
- 2 Minutes to read
- Print
- DarkLight
- PDF
License Management API
- Updated on 17 May 2024
- 2 Minutes to read
- Print
- DarkLight
- PDF
The Licenses Management API offer a simple mechanism for querying, creating, and updating licenses, and related data:
- Create License - creates a specified license
- Get License - describes an specified license
- List Licenses - describes all licenses, filtered as specified
- Update License - updates a specified license
- Delete License - deletes a specified license
Authenticating to Licenses Management API
The following is a summary of access types and their corresponding requirements for various API keys types and endpoints within this API.
Access Type | Requirements |
---|---|
System API Keys | Use/Manage Feeds |
Feed API Keys | View/Download is required for all endpointsAdd/Repackage is required for Create LicenseOverwrite/Delete is required for Delete License |
Personal API Key | Feeds_ViewFeed is required for all endpointsFeeds_AddPackage is required for Create LicenseFeeds_DeletePackage is required for Delete License |
No API Key | anonymous or authenticated user must have at least Feeds_ViewFeed |
To specify an API Key, use the request header (X-ApiKey
), querystring (key
), or api:«api-key»
as the username. See API Key Usage to learn more.
For example, to authenticate with the API key abc12345
to List Licenses, you could specify the API key as follows:
curl -X GET --header "X-ApiKey: abc12345" "https://proget.corp.local/api/management/licenses/list"
Data Specifications
License Object Attributes
License
is a set of key/value pairs that correspond to the fields on a Feed. It's used as input for Create License, and output for Get License and List Licenses.
licenceId
and title
properties are required for Create License. Unless otherwise indicated, omitting a property or supplying null
as the value will keep the current setting.
Property | Format | Notes |
---|---|---|
licenseId | string | an SPDX license identifier |
title | string | a friendly name for the license |
urls | array | array of URLs used to map a package license to SPDX identifer |
allowed | bool | indicates whether a license is allowed (true ) or blocked (false ) at the global level |
allowedFeeds | array | array of feed names that contain a license rule set to allow the license |
blockedFeeds | array | array of feed names that contain a license rule set to block the license |
JSON Object
{
"licenseId": "MIT",
"title": "MIT License",
"urls": [
"https://spdx.org/licenses/MIT.html"
],
"allowed": true,
"allowedFeeds": [
"npm-approved",
"nuget-approved"
],
"blockedFeeds": [
"restricted-feed",
"nuget-unapproved"
]
}
Notes about Data
Wildcards and Negations
Certain fields noted above support wildcard and negation syntax. For example, the value ["Microsoft.*", "Castle.*", "!Rubbishsoft.*"]
has the following properties:
- includes any packages that start with
Microsoft.
orCastle.*
- excludes any packages that start with
Rubbishsoft.