POST /api/dms/objects/tags/{name}/state/{state}?query=<SQL>

As of Versionproduct version 2020 Summer | component version 2020 Summer
Request MethodPOST
Response FormatJSON
Required Permissionaction write
>> Roles and Role Sets
Description

To update/add a tag on the first match according to the CMIS-based search query provided with a query= parameter, send a request with the tag's name and state. If the specified object has already a tag with the sent name, the current state value is replaced by the new one. Otherwise a tag with the sent name and state is added.

In both cases, update or addition, the tag's creationDate will be updated.

Any successful tag creation or update is added to the audit trail, as well as any retrieval of the metadata.

Further objects matched by the query remain unchanged. However, if the operation fails, it will be applied to the next object matching the query. Essentially, the search process is limited to a maximum number of 40 matches. In case there is no fitting object left, an empty list will be returned.

Tags are independent of an object's version and thus are always available at the current version. For version-specific information, metadata provide the suitable options.

Request Example

POST /api/dms/objects/tags/tag1/state/100?query=SELECT * FROM document WHERE system:tags[tag1] IS NULL AND system:creationDate=TODAY()

The query searches for objects which were created today and do not have a tag with the name 'tag1'. To the first match, a new tag 'tag1' will be added with the state '100'.

Result Example

The return is a JSON structure containing the information on existing tags and metadata dedicated to the modified object.

{
  "objects": [
    {
      "properties": {
        "system:objectId": {
          "value": "insert-objectid-here"
        },
        "system:tags": { 
          "value": [ [ "tag1", 100, "2020-02-20T02:22:20.220Z", "1234567887654321" ] ] 
        },
        "system:baseTypeId": {
          "value": "system:document"
        },
        "system:objectTypeId": {
          "value": "document"
        },
        "system:secondaryObjectTypeIds": {
          "value": [
            "system:rmDestructionRetention"
          ]
        },
        "system:createdBy": {
          "value": "this-id-indicates-the-user"
        },
        "system:creationDate": {
          "value": "2020-02-20T02:02:20.220Z"
        },
        "system:lastModifiedBy": {
          "value": "this-id-indicates-another-user"
        },
        "system:lastModificationDate": {
          "value": "2020-02-20T02:20:22.220Z"
        },
        "system:versionNumber": {
          "value": 1
        },
        "system:tenant": {
          "value": "default"
        },
        "system:traceId": {
          "value": "abcdef123456"
        },      
        "Name": {
          "value": "Email"
        },
        "date": {
          "value": "2002-02-20T02:20:00.220Z"
        }
      },
      "contentStreams": [
        {
          "contentStreamId": "0B469DD0-AA6F-11EA-A7FE-DD3E0B230EEB",
          "archivePath": "default/DOCUMENT/B4/69/D/",
          "length": 200001,
          "mimeType": "application/pdf",
          "fileName": "exchange-doku-jar.pdf",
          "digest": "334A9337CFEFC4B1D25C9CC0289205B3133DA4CDE8086C6A9D2FF61CC3205F55",
          "repositoryId": "repo252"
        }
      ]
    }
  ]
}