queryRecords

This method returns a list of records owned by the current user. By default, you only get the records created by your application. To query the records from another application, you must filter by the license id of this application.

Parameters

Name

Type

Required

Description

cortexToken

string

yes

query

object

yes

An object to filter the records.

orderBy

array of objects

yes

Specify how to sort the records.

limit

number

no

The maximum number of records that this method should return. A limit of zero means no maximum.

offset

number

no

The number of record that this method should skip before returning the result. If the limit is zero, then Cortex will ignore this parameter.

includeMarkers

boolean

no

This parameter was added in Cortex 2.1

includeSyncStatusInfo

boolean

no

If true then the record object in the result will include the field "syncStatus". This field tells you if the record was uploaded to the EMOTIV cloud or not.

The default value is false.

This parameter was added in Cortex 2.6.3

Depending on the query, this method may return a lot of records. To avoid performance issues, you should always set an offset and a limit.

query

The query object can contain one or more of these fields:

Name

Type

Description

licenseId

string

Set this parameter to filter the records by their license.

applicationId

string

If you set the licenseId, then you can set this parameter to further filter the records by application.

keyword

string

Set this parameter to filter the records by title, description, or subject name.

startDatetime

object

An object with fields "from" and "to" to filter the records by their start date time.

modifiedDatetime

object

An object with fields "from" and "to" to filter the records by their modification date time.

duration

object

An object with fields "from" and "to" to filter the records by their duration.

orderBy

The orderBy parameters is an array of objects, similar to the orderBy clause of a SQL request.

Each object must have a single attribute. The key of the attribute is the name of record's field you want to order by. The value of the attribute must be "ASC" or "DESC", to order is ascending or descending order.

For example, to order the records by their start date, in descending order, you must use the object {"startDatetime":"DESC"}. To sort the records by title, in alphabetical order, you must use {"title":"ASC"}.

You can order the records by these fields: title, description, startDatetime, modifiedDatetime, duration, subjectName, applicationId. The option to order by applicationId was added in Cortex 2.5.0

limit and offset

These parameters are to implement pagination. It useful if you want to display the records in a UI. You must order the results to use these parameters.

First you should call this method with an offset of zero, and a limit of X. In the response, check the value of count. If count is greater than the limit, then you should call this method again with an offset of X. And then with an offset of 2*X, 3*X... until you get all the records for your query.

Result

The result is an object that includes these fields:

Name

Type

Description

records

array of objects

count

number

The total number of records that match the query.

limit

number

The limit you specified in the parameters.

offset

number

The offset you specified in the parameters.

Examples

Get the 10 most recent records created by EmotivPRO.

{
    "id": 1,
    "jsonrpc": "2.0",
    "method": "queryRecords",
    "params": {
        "cortexToken": "xxx",
        "limit": 10,
        "offset": 0,
        "orderBy": [
            { "startDatetime": "DESC" }
        ],
        "query": {
            "applicationId": "com.emotiv.emotivpro",
            "licenseId": "yyy"
        },
        "includeSyncStatusInfo": true
    }
}

Get some records using a keyword.

{
  "id": 1,
  "jsonrpc": "2.0",
  "method": "queryRecords",
  "params": {
    "cortexToken": "xxx",
    "includeMarkers": true,
    "limit": 2,
    "offset": 0,
    "orderBy": [
      {
        "startDatetime": "DESC"
      }
    ],
    "query": {
      "keyword": "Cortex Example"
    }
  }
}

Last updated