Asset Directory API
The Asset Directory API provides several pgutil commands (available as pgutil assets
) and HTTP endpoints to query, download, publish, delete, and perform other operations on files and folders in an asset directory. All HTTP requests are made through the following base URL:
/endpoints/«AssetDirectoryName»/...
Asset Directories are represented internally in ProGet as Feeds, so Feed API keys can be used to authenticate to Asset Directories.
pgutil Commands
All HTTP endpoints of the The Asset Directory API are available as pgutil
commands.
To find the list of commands available in pgutil
, simply run pgutil assets
. See Getting started with pgutil to learn more.
Available HTTP Endpoints
The Asset Directory API is comprised of endpoints for both files and folders:
📄 File Management
For directly managing the files located in the asset directory. They are designed to function like a standard web server, so hosted files can be accessed by simple GET requests with support for browser caching.
- Download Asset File - returns the content of a specified file or the files's headers
- Upload Asset File - uploads a specified file to the asset directory
- Delete Asset File - deletes a specified file from the asset directory
📁 Folder Management
For managing the folders located in the asset directory.
- List Asset Folder - describes assets in a specified folder
- Create Asset Folder - creates a new subfolder
- Delete Asset Folder - deletes a specified subfolder
- Export Asset Folder - exports the contents of a folder as either a
ZIP
or aTGZ
archive - Import Archive - imports the contents of either a
ZIP
or aTGZ
archive as a subfolder
🔖 Metadata Management
Allow for reading or updating metadata on a file or folder. Added in ProGet v6.0.0.
- Get Asset Metadata - describes the metadata for the specified file or folder
- Set Asset Metadata - sets/updates the
Content-Type
or user-defined metadata of a file or folder.
Authenticating to Asset Directory API
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 uploading/importingOverwrite/Delete is required for deletion |
Personal API Key | Feeds_ViewFeed is required for all endpointsFeeds_AddPackage is required for uploading/importingFeeds_DeletePackage is required for deletion |
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 List Asset Folders, you could specify the API key as follows:
curl -X GET --header "X-ApiKey: abc12345" "https://proget.corp.local/endpoints/internal-files/dir/"
Data Specifications
AssetDirectoryItem Object Attributes
AssetDirectoryItem
is a JSON object (see AssetDirectoryItem.cs) that corresponds to the properties an "item" (either a file or folder) within the Asset Directory. It's used as output data for List Asset Folder and Get Asset Metadata.
JSON Object Example:
{
"name": "example.txt",
"parent": "/documents",
"type": "text/plain",
"content": "https://proget.corp.local/endpoints/myAssetDirectory/content/documents/example.txt",
"created": "2023-11-29T09:45:00",
"modified": "2023-11-29T10:30:00",
"size": 1024,
"sha1": "a1b2c3d4e5f6g7h8i9j0"
}
AssetItemMetadataUpdate Object Attributes
AssetItemMetadataUpdate
is a JSON object (see AssetItemMetadataUpdate.cs) that correspond to the fields in a metadata update. It's used as input data for Set Asset Metadata
JSON Object Example
{
"type": "application/json",
"userMetadata":
{
userMetadata // userMetaData Object
},
"userMetadataUpdateMode": "update",
"cacheHeader":
{
"type": "TTL",
"value": 60
}
}