ProGet Documentation

Asset Directory API

The Asset Directory API provides simple RESTful access to all asset storage capabilities. Like feeds, asset directories expose their APIs through the URL /endpoints/«AssetDirectoryName»/...

Content API

The Asset Content API is accessible under /endpoints/«AssetDirectoryName»/content/..., and provides the primary access point for working with assets. This endpoint is designed to function like a standard web server, so hosted assets can be accessed by simple GET requests with support for browser caching.

Get Asset Endpoint

GET .../content/«path_to_asset»

Gets the asset at the specified path, returning it as content. This endpoint returns a status of 200 (success), 304 (success, not modified), 404 (asset not found), 401 (auth required), 403 (access denied).

On success, the asset is returned as content.

Test for Asset Endpoint

HEAD .../content/«path_to_asset»

Returns the headers only for the GET endpoint. This can be used to determine if an asset exists. This endpoint returns a status of 200 (success), 304 (success, not modified), 404 (asset not found), 401 (auth required), 403 (access denied).

Note that as this is a HEAD request, there is no content in the response.

Create or Replace Asset Endpoint

POST .../content/«path_to_asset»

Creates a new asset (or overwrites an existing asset) at the specified path using the request content as the asset. This endpoint returns a status of 201 (success), 401 (auth required), 403 (access denied).

On success, the asset is saved to the asset directory.

Create Asset Endpoint

PUT .../content/«path_to_asset»

Creates a new asset (but will not overwrite an existing asset) at the specified path using the request content as the asset. This endpoint returns a status of 201 (success), 400 (asset already exists), 401 (auth required), 403 (access denied).

On success, the asset is saved to the asset directory.

Replace Asset Endpoint

PATCH .../content/«path_to_asset»

Overwrites an existing asset at the specified path using the request content as the asset. This endpoint returns a status of 201 (success), 404 (asset not found), 401 (auth required), 403 (access denied).

On success, the existing asset is replaced.

Delete Asset Endpoint

DELETE .../content/«path_to_asset»

Deletes the asset at the specified path. The path must refer to an invidual asset and not a directory. It is not considered an error to delete a file that does not exist. This endpoint returns a status of 200 (success), 400 (path refers to a directory), 401 (auth required), 403 (access denied).

On success, the asset is deleted from the asset directory.

Directory API

The Asset Directory API is accessible under /endpoints/«AssetDirectoryName»/dir/..., and extends the Content API by providing explicit endpoints for working with directories.

List Directory Endpoint

GET .../dir/«path»?recursive=«true/false»

Returns all assets and directories in the specified path as an array of JSON items. When recursive is false or not specified, only items contained in the specified path are returned. When recursive is true, all items in subdirectories are also returned. This endpoint returns a status of 200 (success), 404 (directory not found), 401 (auth required), 403 (access denied).

Data Specification

  • Asset Item
Property Format
name A string containing the local name of the asset. This property does not include the full path.
parent A string containing the full path of the parent directory of the asset. This property does not include the name of the asset itself. This property may be omitted if the asset is contained in the directory root.
type A string containing either the Content-Type of the the asset, or the literal text dir if the item represents a subdirectory.
created A string containing the UTC date of the original creation time of the item in ISO 8601 format (yyyy-MM-ddThh:mm:ss).
modified A string containing the UTC date of the last time of the item was updated in ISO 8601 format (yyyy-MM-ddThh:mm:ss). This property is omitted if the item represents a subdirectory.
size A number specifying the number of bytes in size of the asset item. This property is omitted if the item represents a subdirectory.
sha1 A string containing the SHA1 hash of the asset item. This property is omitted if the item represents a subdirectory.

On success, a JSON array of the above objects is returned.

Create Directory Endpoint

POST .../dir/«path»

Creates a directory at the specified path. If any of the parent directories do not exist, they will be created as well. It is not an error if the directory already exists. This endpoint returns a status of 201 (success), 401 (auth required), 403 (access denied).

Delete API

The Asset Delete API is accessible under /endpoints/«AssetDirectoryName»/delete/..., and further extends the Content API by providing explicit endpoints for deleting items without using an HTTP DELETE request.

Delete Item Endpoint

POST .../delete/«path»?recursive=«true/false»

Deletes the asset or directory at the specified path. When recursive is false or not specified and the path refers to a directory, the directory will only be deleted if it is empty. When recursive is true, the item and all of its contents (if it is a directory) will be deleted. It is not an error if the directory does not exist. This endpoint returns a status of 200 (success), 400 (directory not empty and recursive=false), 401 (auth required), 403 (access denied).

Export API

The Asset Export API is accessible under /endpoints/«AssetDirectoryName»/export/..., and provides endpoints for downloading batches of assets at once.

Export Directory Endpoint

GET .../export/«path»?format=«zip/tgz»&recursive=«true/false»

Returns the contents of the specified directory as either a ZIP or a TGZ archive. The format argument may be either zip (for a zip file) or tgz for a GZipped tar file. When recursive is false or not specified, only items contained directly in the specified path are included. When recursive is true, the archive will contain all subdirectories as well. This endpoint returns a status of 200 (success), 404 (directory not found), 400 (invalid format), 401 (auth required), 403 (access denied).

Import Directory Endpoint

POST .../import/«path»?format=«zip/tgz»&overwrite=«true/false»

Adds the contents of the uploaded archive to the specified path. The format argument may be either zip (for a zip file) or tgz for a GZipped tar file. When overwrite is false or not specified, items already in the asset directory will never be overwritten. When overwrite is true, items in the asset directory will be overwritten. If the specified directory does not exist, it will be created. This endpoint returns a status of 200 (success), 400 (invalid format), 401 (auth required), 403 (access denied).