The content entity search endpoint allows you to search any content in Content Gate.

Based on the permissions of the user executing the search query, the results might be filtered.

  • Only content entities will be returned where the user has permissions to view it's category.
  • Only content entities will be returned where the user has permissions to read at least one of the related business entities. So if a content entity is linked to a certain customer in F&O, but the user is not allowed to read that customer in F&O, Content Gate will not return that content entity.

You can disable checking the external business entities under General Settings -> Security -> Check access to external entities. This can improve the search performance quite a lot, however this will disable the access check for all users and for all operations (e.g. also for downloads).

Endpoint

The endpoint is located at [content-gate-url]/api/contententities/search and requires an http POST request with a search query expressed in JSON in it's body.

Search query

The search query consists of a number of filters to filter content entities by and optionally some pagination parameters.

Filter by content entity template

To filter by content entity templates include an array called "templates" in your search query containing the content entity template id's to include. Only content entities linked to any of these templates will be returned.

Filter by storage provider

To filter by storage provider include an array called "storageProviders" in your search query containing the storage provider id's to include. Only content entities stored in any of these providers will be returned.

Filter by business entity

To filter by business entity include an array called "businessEntities" in your search query containing the business entity id's to include. Only content entities related to any of these business entities will be returned.

Filter by business entity type

To filter by business entity type include an array called "businessEntityTypes" in your search query containing the business entity type id's to include. Only content entities linked to any business entity with any of these types will be returned.

Filter by content entity property

To filter by content entity properties include an array called "properties" in your search query containing the property expressions to filter on. Only content entities matching these property expressions will be returned. A property expression contains:

  • a property named "property" which can be the id or api name of a property. It is also possible to use the following system properties:
    • -1 Category
    • -2 CreatedBy
    • -3 CreatedOn
    • -4 FileSize
    • -6 Type (this is an alias for the file extension)
    • -7 Version
    • -8 ChangedOn
    • -9 ChangedBy
    • -10 ContentRequirement (this is the id of the content entity requirement linked to the content entity)
    • -13 Id (this is the id of the content entity)
    • -14 Title
    • -15 FileExtension
    • -16 MimeType
  • A property named "operator" to compare the content entity property with. Make sure the operator is compatible with the data type of the property you are filtering by. Allowed operators are:
    • Equals
    • GreaterThan
    • GreaterThanOrEqual
    • LessThan
    • LessThanOrEqual
    • StartsWith
    • EndsWith
    • Contains (can be used to check if a text property contains some subtext or if a multi-valued property contains some exact value)
    • Between
    • In (can be used to check if the property is IN a list of supplied values)
  • A property named "value" which contains the value to filter content entity properties by. Some operators (Between and In) expect more then one value, these values should be placed in an array.
  • Optionally a property named "negate" which contains a boolean that can flip the expression. So an expression saying Title Equals "Test" with negate set to true will evaluate to Title Does Not Equal "Test". This will default to false if not included in the query.

Paginate the result

To paginate the result an object called "paging" can be included in your search query. This object can contain the following properties:

  • page - the page to return - defaults to 1 which is the first page
  • pageSize - the number of possible results per page (the actual number of results can be less due to permissions of the user) - defaults to 500 which is also the maximum
  • sortBy - Which property to sort by. The allowed properties are the same as the properties you can filter on.
  • sortOrder - Can be "ascending" or "descending"

Examples

Simple search query

This example represents a search query to return all content entities with a category with id 5 (e.g. 'Contracts') and related to a business entity type with id 5 (e.g. 'Customers'). It uses the default pagination and will return the first page with a maximum of 500 items.

http POST https://customer.content-gate.com/api/contententities/search

{
    "businessEntityTypes": [5],
    "properties": [
        {
            "property": "category",
            "operator": "Equals",
            "value": 1
        }
    ]
}

Extensive search query

This example represents a search query with a lot of filters. Only content entities which match all the filters are returned.

http POST https://customer.content-gate.com/api/contententities/search

{
    "templates": [10, 11], // only include content entities related to these content entity templates
    "storageProviders": [4], // only include content entities stored in the storage provider with id 4
    "businessEntities": [9001, 9002, 9003, 9004, 9005], // only include content entities from business entities with these ids
    "businessEntityTypes": [1, 2, 3], // only include content entities related to a business entity of this type
    "properties": [
        // only include content entities where the title starts with 'Project initiation'
        {
            "property": "title",
            "operator": "StartsWith",
            "value": "Project initiation"
        },
        // only include content entities where the category id does not equal 5, 6 or 7
        {
            "property": -1, // internal id of the category property
            "operator": "In",
            "value": [5, 6, 7],
            "negate": true
        },
        // only include content entities where the content property with api name due_date is set to a value greater than or equal to december 31st 2024
        {
            "property": "due_date",
            "operator": "GreaterThanOrEqual",
            "value": "2024-12-31"
        }
    ],
    // chunk the results in pages of 100 items and return me the 12th page. sort the results by content entity id.
    "paging": {
        "page": 12,
        "pageSize": 100,
        "sortBy": "Id",
        "sortOrder": "descending"
    }
}