Part 10: Tagging

Tagging items in a case.

Tagging

Let’s tag some items in the case. For this example, we will tag all files with an HTML file extension. Additionally, we want to exclude duplicates so we are going to use the item set we created earlier in the tutorial.

curl --location --request POST 'http://localhost:8080/nuix-restful-service/svc/v2/cases/43b070164ce8453ca30ed9e2dfcce67b/itemTags' \
--header 'nuix-auth-token: 9729a460-eda7-48dc-ba70-d12b3aae3c8d' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--data-raw '{
  "query": "item-set-originals:HelloItemSet AND file-extension:html",
  "tagList": [
    "HTMLFiles"
  ]
}'
{
    "tagList": [
        "HTMLFiles"
    ],
    "successfulTags": [
        "HTMLFiles"
    ],
    "failedTags": []
}

Tag Verification

Let’s verify the items that we have tagged using a simple synchronous search. We will use the query tag:HTMLFiles. The search returned 302 results.

curl --location --request GET 'http://localhost:8080/nuix-restful-service/svc/v2/cases/43b070164ce8453ca30ed9e2dfcce67b/search?query=tag:HTMLFiles&metadataProfile=Default&numberOfRecordsRequested=5' \
--header 'nuix-auth-token: 9729a460-eda7-48dc-ba70-d12b3aae3c8d'
{
    "request": {
        "caseId": "43b070164ce8453ca30ed9e2dfcce67b",
        "query": "tag:HTMLFiles",
        "sortField": null,
        "sortOrder": null,
        "startIndex": 0,
        "numberOfRecordsRequested": 5,
        "deduplicate": null,
        "metadataProfile": "Default",
        "fieldList": null,
        "customMetadataList": null,
        "propertyList": null,
        "itemParameterizedFields": null,
        "showAvailableThumbnails": false,
        "useCache": false,
        "forceCacheDelete": false,
        "searchRetry": 0,
        "relationType": null,
        "entities": [],
        "p": 5,
        "s": 0,
        "customMetadataField": null,
        "field": null,
        "property": null
    },
    "startedOn": 1612986781150,
    "completedOn": 1612986781172,
    "elapsedTimeForSearch": 16,
    "elapsedTimeForSort": 0,
    "elapsedTimeForMarshal": 2,
    "elapsedTimeForDeduplicate": 0,
    "elapsedTotal": 22,
    "metadataItems": [
        "Name",
        "File Type",
        "Path Name"
    ],
    "localizedMetadataItems": [
        "Name",
        "File Type",
        "Path Name"
    ],
    "metadataItemDetails": [
        {
            "name": "Name",
            "localisedName": "Name",
            "type": "String"
        },
        {
            "name": "File Type",
            "localisedName": "File Type",
            "type": "String"
        },
        {
            "name": "Path Name",
            "localisedName": "Path Name",
            "type": "String"
        }
    ],
    "resultList": [
        {
            "File Type": "Hypertext Markup Language Document",
            "Name": "allclasses.html",
            "Path Name": "/d29719c8-517e-48cb-9fd6-983dd2d6671b/doc/api",
            "guid": "4350a26e-0582-4cdd-8903-feb2454b66ad"
        },
        {
            "File Type": "Hypertext Markup Language Document",
            "Name": "allclasses-index.html",
            "Path Name": "/d29719c8-517e-48cb-9fd6-983dd2d6671b/doc/api",
            "guid": "48fdd676-ecdf-4271-8fb0-a312570888a5"
        },
        {
            "File Type": "Hypertext Markup Language Document",
            "Name": "allpackages-index.html",
            "Path Name": "/d29719c8-517e-48cb-9fd6-983dd2d6671b/doc/api",
            "guid": "b5d26466-0b5f-4b01-bc2e-7ebe6c6d3294"
        },
        {
            "File Type": "Hypertext Markup Language Document",
            "Name": "index.html",
            "Path Name": "/d29719c8-517e-48cb-9fd6-983dd2d6671b/doc/api",
            "guid": "8bc28b97-6d5a-4755-8066-4fa2102705de"
        },
        {
            "File Type": "Hypertext Markup Language Document",
            "Name": "constant-values.html",
            "Path Name": "/d29719c8-517e-48cb-9fd6-983dd2d6671b/doc/api",
            "guid": "ee4cb26f-30b5-4a76-8789-dfbd7fdecf65"
        }
    ],
    "count": 302,
    "deduplicatedCount": 302
}

Counting Tags

Instead of using search, let’s verify how many items we have tagged using the count endpoint. The response verifies that we have tagged 302 HTML files.

curl --location --request POST 'http://localhost:8080/nuix-restful-service/svc/v1/cases/43b070164ce8453ca30ed9e2dfcce67b/count' \
--header 'nuix-auth-token: 9729a460-eda7-48dc-ba70-d12b3aae3c8d'
--header 'Content-Type: application/json' \
--data-raw '{
    "query": "tag:HTMLFiles"
}'
{
    "count": 302,
    "query": "tag:HTMLFiles",
    "casePath": "/Cases/HelloWorld",
    "caseGuid": "43b070164ce8453ca30ed9e2dfcce67b"
}
Last modified February 10, 2021