Use fields to refine /search output
When specifying output=summary
in a /search
request, use the fields
parameter to define the data fields to be included with or excluded from search results.
The following example GET request shows a
/search
call with multiple options specified for the
fields
parameter:
curl -s "http://example.company.com/search/ExampleCo/ExampleOrg/ExampleFolder?token=1234567890&daterange=20210701-20210702&format=csv&output=summary&fields=filename,duration"
In the preceding example, the
output=summary&fields=filename,duration
parameters include only the
filename
and
duration
fields in search results.
The following example GET request shows how to exclude fields:
curl -s "http://example.company.com/search/ExampleCo/ExampleOrg/ExampleFolder?token=1234567890&daterange=20210701-20210702&format=csv&output=summary&fields=all,-agentid"
In the preceding example, the
output=summary&fields=all,-agentid
parameters include
all
(both
voci
and
CLIENT-DATA
) fields except for
agentid
in search results.
When specifying values for the
fields
parameter using a POST request, the submitted JSON data must list fields as a JSON-formatted list, even if there is only one value, as in the following example POST request:
curl -H 'Content-type: application/json' -d '{"output":"summary","fields":["all","-datetime","-requestid","-diarization"]}' -X POST 'http://example.company.com/search/ExampleCo/ExampleOrg/ExampleFolder?token=1234567890'
In the preceding example,
{"output":"summary","fields":["all","-datetime","-requestid","-diarization"]}
is a JSON-formatted set of parameters that includes
all
fields, except for the excluded fields
datetime
,
requestid
, and
diarization
. These parameters may also be submitted in a JSON file, as in the following example:
curl -H 'Content-type: application/json' -d @params.json -X POST 'http://example.company.com/search/ExampleCo/ExampleOrg/ExampleFolder?token=1234567890'
In the preceding example, JSON-formatted parameters are replaced with a reference to the file containing them, which in this case is named
params.json
. Note that using a file with cURL requires inserting the
@
symbol before the filename.