License Management API
  • 22 Jan 2024
  • 2 Minutes to read
  • Dark
    Light
  • PDF

License Management API

  • Dark
    Light
  • PDF

Article Summary

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

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

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?