Tagging

This example tags all PDF files in a case with the “pdf” tag and returns the number of items tagged.

Example Scripts

1
2
3
4
5
6
7
8
query="file-extension:pdf"
items=$current_case.searchUnsorted(query)

items.each do |item|
    item.addTag("pdf")
end

response.setBody(items.length())
1
2
3
4
5
6
7
8
query="file-extension:pdf"
items=current_case.searchUnsorted(query)

for (item in items) {
    item.addTag("pdf");
}

response.setBody(items.length)
1
2
3
4
5
6
7
query="file-extension:pdf"
items=current_case.searchUnsorted(query)

for item in items:
    item.addTag("pdf")
    
response.setBody(len(items))

Example Request

curl --location --request PUT 'http://localhost:8080/nuix-restful-service/svc/v1/cases/{caseId}/userScripts' \
--header 'nuix-auth-token: YOUR_AUTH_TOKEN' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--data-raw '{
  "fileName": "tagItems.rb",
  "language": "RUBY",
  "async": false
}'
wget --no-check-certificate --quiet \
  --method PUT \
  --timeout=0 \
  --header 'nuix-auth-token: YOUR_AUTH_TOKEN' \
  --header 'Content-Type: application/json' \
  --header 'Accept: application/json' \
  --body-data '{
  "fileName": "tagItems.rb",
  "language": "RUBY",
  "async": false
}' \
   'http://localhost:8080/nuix-restful-service/svc/v1/cases/{caseId}/userScripts'