Update Metadata Endpoint
  • 20 Dec 2023
  • 1 Minute to read
  • Dark
    Light
  • PDF

Update Metadata Endpoint

  • Dark
    Light
  • PDF

Article Summary

The Update Metadata is an endpoint in ProGet's Asset Directory API. It updates the Content-Type or the user-defined metadata of an "item" (file or folder). The request body must have a Content-Type of application/json, and must contain a MetadataUpdate JSON object.

🚀 Quick Example: Update metadata of a file with Curl

This example updates the metadata of a file log_data.bin, changing its cacheHeader value to "2 weeks" (i.e. 1,209,600 seconds), authenticating with the API key abc12345:

curl -X POST --header "X-ApiKey: abc12345" -H "Content-Type: application/json" -d "{\"userMetadataUpdateMode\":\"update\",\"cacheHeader\":{\"type\":\"TTL\",\"value\":1209600}}" https://proget.corp.local/endpoints/internal-files/metadata/log_data.bin

Request Specification

To update an item's metadata, simply POST to the URL with the AssetDirectoryName, path to the item and a a MetadataUpdate object as the body.

GET /endpoints/«AssetDirectoryName»/metadata/«path_to_file»

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

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

{
  "type": "application/json",
  "userMetadata": {
    "key1": "value1",
    "key2": "value2"
  },
  "userMetadataUpdateMode": "update",
  "cacheHeader": {
    "type": "TTL",
    "value": 60
  }
}

Response Specification

ResponseDetails
200 (Success)the file or folder's metadata will be updated
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?