License Management API
  • 17 May 2024
  • 2 Minutes to read
  • Dark
    Light
  • PDF

License Management API

  • Dark
    Light
  • PDF

Article Summary

The Licenses Management API offer a simple mechanism for querying, creating, and updating licenses, and related data:

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 TypeRequirements
System API KeysUse/Manage Feeds
Feed API KeysView/Download is required for all endpoints
Add/Repackage is required for Create License
Overwrite/Delete is required for Delete License
Personal API KeyFeeds_ViewFeed is required for all endpoints
Feeds_AddPackage is required for Create License
Feeds_DeletePackage is required for Delete License
No API Keyanonymous 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.

🚀 Quick Example: Authenticating with curl

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.

PropertyFormatNotes
licenseIdstringan SPDX license identifier
titlestringa friendly name for the license
urlsarrayarray of URLs used to map a package license to SPDX identifer
allowedboolindicates whether a license is allowed (true) or blocked (false) at the global level
allowedFeedsarrayarray of feed names that contain a license rule set to allow the license
blockedFeedsarrayarray 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. or Castle.*
  • excludes any packages that start with Rubbishsoft.

Was this article helpful?

What's Next