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

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:

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:

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