Add metadata and tags to a file

This endpoint appends tags to a target file in the datalake or modifies the value of a metadata key. This endpoint requires either fileId or bucket, fileKey and version to be provided in order to uniquely identify a file.

Target file query is determined by field originalFile. Target file is queried in two ways:

  1. by fileId (UUID of a file in datalake)
  2. by bucket, fileKey and version

Endpoint finds target file by given file query and creates new version with updated metadata and tags. If payload contains neither metadata nor tags, endpoint will return existing file from datalake.

Parameters metadata and tags description:

  1. metadata is JSON object, e.g. { "key1": "value", "key2": "2" }
  2. metadata can have empty string values
  3. metadata entry field can be null and in that case it will remove custom metadata value on target file
  4. tags is JSON array, e.g. ["a", "b"]
    Here is an example payload for this endpoint:
    {
    "originalFile": {
    "fileKey": "tetrascience/47ab98d5-cccb-4a7d-86f4-0ff8f7c11bdf/RAW/WAT12/Test_0504/Test_SignOff/PQ Sample Set/1135/19970917300559.json",
    "bucket": "ts-platform-dev-datalake",
    "version": "dUzbISdeNgKXuSsv.lUT73qr7lYoby_u",
    "type": "s3file"
    },
    "metadata": {
    "a": "a",
    "b": "",
    "c": "Test"
    },
    "tags": ["Boston", "San Fran", "123"]
    }
    It will append any existing metadata/tags with the ones listed in the payload.

Validations performed by this endpoint:

  1. if parameter fileId is not provided, then all three parameters (bucket, fileKey and version) must be provided
  2. if any one of parameters bucket, fileKey and version is not provided, then parameter fileId must be provided
  3. metadata keys can only include letters, numbers, spaces, and the symbols +, -, or _
  4. metadata values can only include letters, numbers, spaces, and the symbols +, -, _, /, . or ,
  5. tags must contain only letters, numbers, spaces, and the symbols +, -, ., / or _ and they must be unique
  6. metadata and tags together as JSON objects must have less than 1.5KB of text (1536 characters)
Language
Credentials
Click Try It! to start a request and see the response here!