• Register

Search API

The Search API allows you to find content stored in Egnyte based on filenames, metadata, and text content. Searches are performed in the context of the user token being passed. Accordingly, a user will only see results for contents they have permission to access. The search API has been extended to support searching for metadata fields in files, versions, or folders. When searching metadata, call the API with a POST request to /pubapi/v1/search with a JSON body.

Similarity Search - Request Examples 

{  
  "mlt": [  
  	"83d56dc9-2290-4645-b68d-98e3ec123891"
  	"753e3124-ae6c-4aa6-b9a8-933c16835f9f"
  ],   
  "mltt": [         
       "Includes notices to bidders, substitution request forms, and various standard forms. Division 01 covers general requirements."
  ],
  "folder": "/Shared/Projects"  
}  
curl --location--request POST
'https://your-egnyte-domain/rest/public/v2/search' \
--header'Content-Type:application/json'  \
--data-raw '{
    "mlt": [ 
 	"83d56dc9-2290-4645-b68d-98e3ec123891",
 	"753e3124-ae6c-4aa6-b9a8-933c16835f9f"
    ],
    "mltt": [
        "Includes notices to bidders, substitution request forms, and various standard forms. Division 01 covers general requirements."
    ],
    "folder": "/Shared/Projects"
 }'

The response for the similarity search is the same as the regular Search response

Request Parameters

Parameter

Description

Required

Possible Values

query

The search string you want to find.

Yes.

Either this field or custom_metadata is required but both may be used at the same time and the search is further filtered.

string, 100 ≥ character length ≥ 3 

offset

The 0-based index of the initial record being requested.

No

Any integer ≥ 0

count

The number of entries per page

No

Any integer [1, 20]

folder

Limit the result set to only items contained in the specified folder and all of its descendants. Note that unlike v1, because this is in the JSON body, the folder parameter should NOT be url-encoded.

No

Valid folder path

modified_before

Limit to results before the specified Unix timestamp in milliseconds 

No

Unix timestamp in milliseconds

modified_after

Limit to results after the specified Unix timestamp in milliseconds

No

Unix timestamp in milliseconds

type

Which item types should be searched.

No

FOLDER, FILE.

By default we support both, e.g. ALL.

snippet_requested

Specifies whether search results should contain snippets. If set to "false", the search results will contain empty snippets.

No

true (default), false

custom_metadata

Json containing values to be searched

Yes. Either this field or query is required but both may be used at the same time and the search is further filtered.

See the next table

namespaces

Array of strings containing the name of the namespaces requested.

Note that the namespace will only be returned if there is a value in any of the fields.

No

Any valid namespace name

sort_by

The field that should be used for sorting.

Results are sorted using score by default.

No

last_modified, size, name, score

sort_direction

The direction of the sort.

No

ascending, descending

query_operator

Search for all words or any of the words.

No

ANY, ALL

uploaded_before

Limit to results uploaded before the specified Unix timestamp in milliseconds

No

Unix timestamp in milliseconds

uploaded_after

Limit to results uploaded after the specified Unix timestamp in milliseconds

No

Unix timestamp in milliseconds

file_query_fields

Search for files using specific fields.

No

One or more of ALL, FILENAME, COMMENTS, CONTENT

folder_query_fields

Search for folders using specific fields.

No

One or more of ALL, FOLDERNAME, DESCRIPTION

mlt

Array of document IDs to use as reference for similar document search

No

string[]

mltt

Array of text content to use as reference for similar document search

No

string[]

folder

Folder path to limit the scope of similarity search

No

string

Custom Metadata JSON

Parameter

Description

Required

Possible Values

namespace

Name of namespace

Yes

A valid namespace name

key

Key to search for

Yes

A valid key. All values will be “AND” searched

operator

Search operator

Yes

EQUALS, BETWEEN, GREATER_THAN, LESS_THAN, CONTAINS, IN, HAS_KEY, SUB_SET

value

Value for operator EQUALS, GREATER_THAN, LESS_THAN, CONTAINS

No (one of “value”, “values”, or “range” is required)

The value to search on. The value for the date should be in milliseconds.

values

List of values for operator IN

No (one of “value”, “values”, or “range” is required)

A valid custom metadata value

range

Range of values for operator BETWEEN

No (one of “value”, “values”, or “range” is required)

See below

start

Start of range which includes the start value, e.g. ≥

No, unless range is used

A valid integer, float, or date in Unix timestamp in milliseconds.

end

End of range but does not include the end range value, e.g. < only

No, unless range is used

A valid integer, float, or date in Unix timestamp in milliseconds.


Response Parameters

Element

Description

count

The number of results returned.

total_count

Use to see if there are more than {total count} results. If the number of results is less than or equal to {total count}, it will return the number of results. Else, returns {total count} + 1.

offset

The 0-based index of the last result in the current set of results, this value should be used as offset value while requesting the subsequent page.

results

A JSON array that holds all of the matched content.

name

The name of the file.

path

The path to the file in Egnyte.

type

The MIME type of the file.

size

The size of the file in bytes.

snippet

A plain text snippet of the text containing the matched content.

snippet_html

An HTML formatted snippet of the text containing the matched content.

entry_id

A GUID for that particular instance of a file.

last_modified

The ISO-8601 formatted timestamp representing the last modified date of the file.

uploaded_by

The formatted name of the user who uploaded the file.

uploaded_by_username

The username of the user who uploaded the file.

num_versions

The number of versions of the file available.

is_folder

A boolean value stating if the object is a file or folder. Please note that, currently, this API only returns file objects.

custom_properties

The json of the custom metadata values of the file or folder

hasMore Returns true if there are more results than were returned.
score A score denoting the relevance of the search result.