- 22 Jan 2024
- 2 Minutes to read
- Print
- DarkLight
- PDF
License Management API
- Updated on 22 Jan 2024
- 2 Minutes to read
- Print
- DarkLight
- PDF
The License Management API Endpoints 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 License Management API Endpoints
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 the Create License endpointOverwrite/Delete is required for the Delete License endpoint |
Personal API Key | Feeds_ViewFeed is required for all endpointsFeeds_AddPackage is required for the Create License endpointFeeds_DeletePackage is required for the Delete License endpoint |
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 the list licenses endpoint, 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 the Create License endpoint, and output for the Get License and List Licenses endpoints.
licenceId
and title
properties are required for the Create License Endpoint. 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.