Get Asset Metadata
  • 03 May 2024
  • 1 Minute to read
  • Dark
    Light
  • PDF

Get Asset Metadata

  • Dark
    Light
  • PDF

Article Summary

Get Asset Metadata is available as both a pgutil command and an HTTP Request, and will return metadata for the specified "item" (file or folder) as a JSON Asset Metadata object

🚀 Quick Example: Get Metadata of a file with Curl

This example returns the metadata of a file log_data.bin, authenticating with the API key abc12345:

curl -X GET --header "X-ApiKey: abc12345" "https://proget.corp.local/endpoints/internal-files/metadata/log_data.bin"

Command Specification (CLI)

🚧 Coming Soon 🚧

The asset metadata get command is coming soon. Similar to the HTTP Request, it will display the metadata of the specified file or folder.

HTTP Request Specification

To get the metadata of an item, simply GET to the URL with the AssetDirectoryName and path to the item.

GET /endpoints/«AssetDirectoryName»/metadata/«path»

Requesting a folder's metadata requires the asset directory name (e.g. myAssetDirectory), and the folder name (e.g. myFolder)

GET /endpoints/myAssetDirectory/metadata/myFolder

Requesting a file's metadata within a folder requires the asset directory name (e.g. myAssetDirectory), the folder name (e.g. myFolder) and the file name (e.g. mycontent.bin)

GET /endpoints/myAssetDirectory/metadata/myFolder/mycontent.bin

HTTP Response Specification

A successful (200) response body will contain a Metadata object describing a file or folder in the specified path. For example, querying mycontent.bin, the request would return a single object:

{
  "name": "example.bin",
  "size": 5,
  "type": "application/json",
  "content": "http://54.168.224.223:8624/endpoints/public-files/content/example.bin",
  "md5": "8b1a9953c4611296a827abf8c47804d7",
  "sha1": "f7ff9e8b7bb2e09b70935a5d785e0cc5d9d0abf0",
  "sha256": "185f8db32271fe25f561a6fc938b2e264306ec304eda518007d1764826381969",
  "sha512": "3615f80c9d293ed7402687f94b22d58e529b8cc7916f8fac7fddf7fbd5af4cf777d3d795a7a00a16bf7e7f3fb9561ee9baae480da9fe7a18769e71886b03f315",
  "created": "2023-12-08T03:58:11.567Z",
  "modified": "2023-12-08T08:55:31.877Z",
  "userMetadata": {
    "key1": "value1",
    "key2": "value2"
  },
  "cacheHeader": {
    "type": "TTL",
    "value": 60
  }
}

ResponseDetails
200 (Success)the body will contain a Metadata object
401 (Authentication Required)indicates a missing, unknown, or unauthorized API Key
404 (Item not Found)indicates that the file or folder does not exist

Was this article helpful?