- 03 May 2024
- 1 Minute to read
- Print
- DarkLight
- PDF
Update Asset Metadata
- Updated on 03 May 2024
- 1 Minute to read
- Print
- DarkLight
- PDF
Update Asset Metadata is available as both a pgutil
command and an HTTP Request, and will update 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.
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
Command Specification (CLI)
The asset metadata update
command is coming soon. Similar to the HTTP Request, it will update the user defined metadata of a file or folder.
HTTP 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
}
}
HTTP Response Specification
Response | Details |
---|---|
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 |