- 23 Feb 2024
- 1 Minute to read
- Print
- DarkLight
- PDF
Promote Package API
- Updated on 23 Feb 2024
- 1 Minute to read
- Print
- DarkLight
- PDF
The Promote Package API is an endpoint to promote packages in package-based feeds, regardless of the package type:
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 Type | Requirements |
---|---|
System API Keys | Use/Manage Feeds |
Feed API Keys | View/Download Promote |
Personal API Key | Feeds_ViewFeed |
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.
Promote Package Endpoint
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:
Property | Details |
---|---|
name | the name of the package |
group | used only by Universal and npm feeds; for npm, this is the "scope" |
version | the version of the package |
fromFeed | the name of the feed the package will be promoted from |
toFeed | the name of the feed the package will be promoted to |
comments | Optional. 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
Response | Details |
---|---|
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 |