Promote Package API
  • 23 Feb 2024
  • 1 Minute to read
  • Dark
    Light
  • PDF

Promote Package API

  • Dark
    Light
  • PDF

Article Summary

The Promote Package API is an endpoint to promote packages in package-based feeds, regardless of the package type:

🚀 Quick Example: Promoting with Curl

This example promotes a package (myNugetPackage, version 1.2.3) from one feed (nuget-unapproved) to another (nuget-approved), authenticating with the API key abc12345:

curl -X POST "http://proget.corp.local/api/promotions/promote" --header "X-ApiKey: abc12345" -F name=myNugetPackage -F version=1.2.3 -F fromFeed=nuget-unapproved -F toFeed=nuget-approved

Authentication and API Keys

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
Promote
Personal API KeyFeeds_ViewFeed
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.

Promote Package Endpoint

Query Promoted Packages

The endpoint below promotes packages. To query promoted packages, see the Query Package Promotions endpoint, which can be used to return data of previously promoted packages.

Request Specification

To promote a package, simply POST to the URL with an appropriate API Key and JSON object as the body with the following properties:

PropertyDetails
namethe name of the package
groupused only by Universal and npm feeds; for npm, this is the "scope"
versionthe version of the package
fromFeedthe name of the feed the package will be promoted from
toFeedthe name of the feed the package will be promoted to
commentsOptional. Any comments regarding the promotion
POST /api/promotions/promote

For npm feeds, group should be the package scope (e.g. @mycompany or @vue).

For Docker registries, name should be the full repository name (e.g., bitnami/dotnet) and version should be the tag (e.g., a version number).

Promoting an npm package as a JSON request requires the Promotion JSON object as a body

POST /api/promotions/promote Content-Type: application/json

{
  "name": "myNpmPackage",
  "group": "myScope",
  "version": "1.2.3",
  "fromFeed": "npm-unapproved",
  "toFeed": "npm-approved",
  "comments": "This package was approved by admin"
}

Promoting an npm Package as a URL encoded request requires form-encoded values:

POST /api/promotions/promote Content-Type: application/x-www-form-urlencoded

name=myNpmPackage&group=myScope&version=1.2.3&fromFeed=npm-unapproved&toFeed=npm-approved&comments=This+package+was+approved+by+admin

Response Specification

ResponseDetails
200 (Success)the package was promoted
400 (Invalid Input)indicates invalid or missing properties on the package; the body will provide some details as text
403 (Unauthorized API Key)indicates a missing, unknown, or unauthorized API Key

Was this article helpful?