Skip to main content

"listIndexes"

The listIndexes action for the JSON DB API

Abstract

listIndexes lists indexes in the specified database table that the logged-in user is allowed to see.

The "listIndexes" action lists indexes in the specified database table that the logged-in user is allowed to see. It retrieves all indexes associated with a specific table.

Request examples

Minimal request example

{
  "api": "db",
  "authToken": "replaceWithValidAuthtoken",
  "action": "listIndexes",
  "params": {
    "databaseName": "ctreeSQL",
    "tableName": "athlete"
  }
}
{
  "api": "db",
  "apiVersion": "1.0",
  "requestId": "2",
  "authToken": "replaceWithValidAuthtoken",
  "action": "listIndexes",
  "params": {
    "databaseName": "ctreeSQL",
    "ownerName": "admin",
    "tableName": "athlete",
    "skipRecords": 0,
    "maxRecords": 20
  },
  "responseOptions": {
    "binaryFormat": "hex",
    "dataFormat": "objects",
    "numberFormat": "string"
  },
  "debug": "max"
}

Response examples

{
  "authToken": "replaceWithValidAuthtoken",
  "result": {
    "data": [
      {
        "collectStats": false,
        "compression": "off",
        "conditionalExpression": null,
        "databaseName": "ctreeSQL",
        "deferIndexing": false,
        "fields": [
          {
            "caseInsensitive": false,
            "name": "id",
            "reverseCompare": false,
            "sortDescending": false
          }
        ],
        "filename": "admin_athlete.idx",
        "immutableKeys": false,
        "indexName": "id_pk",
        "indexNumber": 0,
        "ownerName": "admin",
        "tableName": "athlete",
        "unique": true
      },
      {
        "collectStats": true,
        "compression": "off",
        "conditionalExpression": null,
        "databaseName": "ctreeSQL",
        "deferIndexing": false,
        "fields": [
          {
            "caseInsensitive": false,
            "name": "ranking",
            "reverseCompare": false,
            "sortDescending": false
          }
        ],
        "filename": "admin_athlete.idx",
        "immutableKeys": false,
        "indexName": "ranking",
        "indexNumber": 1,
        "ownerName": "admin",
        "tableName": "athlete",
        "unique": false
      },
      {
        "collectStats": true,
        "compression": "off",
        "conditionalExpression": null,
        "databaseName": "ctreeSQL",
        "deferIndexing": false,
        "fields": [
          {
            "caseInsensitive": false,
            "name": "earnings",
            "reverseCompare": false,
            "sortDescending": false
          }
        ],
        "filename": "admin_athlete.idx",
        "immutableKeys": false,
        "indexName": "earnings",
        "indexNumber": 2,
        "ownerName": "admin",
        "tableName": "athlete",
        "unique": false
      },
      {
        "collectStats": true,
        "compression": "on",
        "conditionalExpression": "livedpast2000 == 1",
        "databaseName": "ctreeSQL",
        "deferIndexing": false,
        "fields": [
          {
            "caseInsensitive": true,
            "name": "name",
            "reverseCompare": true,
            "sortDescending": true
          }
        ],
        "filename": ".\\ctreeSQL.dbs\\admin_athlete_name_livedpast2000.idx",
        "immutableKeys": false,
        "indexName": "name_livedpast2000",
        "indexNumber": 3,
        "ownerName": "admin",
        "tableName": "athlete",
        "unique": false
      }
    ]
  },
  "errorCode": 0,
  "errorMessage": ""
}
{
  "authToken": "replaceWithValidAuthtoken",
  "result": {
    "data": [
      {
        "collectStats": false,
        "compression": "off",
        "conditionalExpression": null,
        "databaseName": "ctreeSQL",
        "deferIndexing": false,
        "fields": [
          {
            "caseInsensitive": false,
            "name": "id",
            "reverseCompare": false,
            "sortDescending": false
          }
        ],
        "filename": "admin_athlete.idx",
        "immutableKeys": false,
        "indexName": "id_pk",
        "indexNumber": 0,
        "ownerName": "admin",
        "tableName": "athlete",
        "unique": true
      },
      {
        "collectStats": true,
        "compression": "off",
        "conditionalExpression": null,
        "databaseName": "ctreeSQL",
        "deferIndexing": false,
        "fields": [
          {
            "caseInsensitive": false,
            "name": "ranking",
            "reverseCompare": false,
            "sortDescending": false
          }
        ],
        "filename": "admin_athlete.idx",
        "immutableKeys": false,
        "indexName": "ranking",
        "indexNumber": 1,
        "ownerName": "admin",
        "tableName": "athlete",
        "unique": false
      },
      {
        "collectStats": true,
        "compression": "off",
        "conditionalExpression": null,
        "databaseName": "ctreeSQL",
        "deferIndexing": false,
        "fields": [
          {
            "caseInsensitive": false,
            "name": "earnings",
            "reverseCompare": false,
            "sortDescending": false
          }
        ],
        "filename": "admin_athlete.idx",
        "immutableKeys": false,
        "indexName": "earnings",
        "indexNumber": 2,
        "ownerName": "admin",
        "tableName": "athlete",
        "unique": false
      },
      {
        "collectStats": true,
        "compression": "on",
        "conditionalExpression": "livedpast2000 == 1",
        "databaseName": "ctreeSQL",
        "deferIndexing": false,
        "fields": [
          {
            "caseInsensitive": true,
            "name": "name",
            "reverseCompare": true,
            "sortDescending": true
          }
        ],
        "filename": ".\\ctreeSQL.dbs\\admin_athlete_name_livedpast2000.idx",
        "immutableKeys": false,
        "indexName": "name_livedpast2000",
        "indexNumber": 3,
        "ownerName": "admin",
        "tableName": "athlete",
        "unique": false
      }
    ]
  },
  "requestId": "2",
  "debugInfo": {
    "request": {
      "authToken": "replaceWithValidAuthtoken",
      "api": "db",
      "action": "listIndexes",
      "params": {
        "databaseName": "ctreeSQL",
        "ownerName": "admin",
        "tableName": "athlete",
        "skipRecords": 0,
        "maxRecords": 20
      },
      "apiVersion": "1.0",
      "requestId": "2",
      "responseOptions": {
        "binaryFormat": "hex",
        "dataFormat": "objects",
        "numberFormat": "string"
      },
      "debug": "max"
    },
    "serverSuppliedValues": {
      "databaseName": "ctreeSQL",
      "ownerName": "admin"
    },
    "errorData": {
      "errorData": null
    },
    "warnings": []
  },
  "errorCode": 0,
  "errorMessage": ""
}

"params"

The "params" property is an object that contains an action's parameters. Each action defines its own required and optional properties.

Property summary

Table 1. "params" property summaries

Property

Description

Default

Type

Limits (inclusive)

databaseName

specifies the name of a database

Defaults to the "defaultDatabaseName" value that is set during "createSession". If no default is set during "createSession", then "faircom" is used.

string

1 to 64 bytes

maxRecords

specifies the maximum number of records to return from an action. -1 returns all records

20

integer

-1 to 65535

ownerName

specifies the unique name of a schema in a database

""

string

1 to 64 bytes

skipRecords

specifies the number of records to skip over in the results before returning records

0

integer

0 to 9223372036854775807

tableName

specifies the name of a table

Required - No default value

string

1 to 64 bytes



The "databaseName" property is an optional string that specifies the database that contains the tables. It defaults to the database name supplied at login.

Note

In the API Explorer, "defaultDatabaseName" is set to "ctreeSQL" in the "createSession" action that happens at login.

Things to know:
  • A zero-length "databaseName" is invalid.

  • Its limits are from 0 to 64 bytes.

  • If the "databaseName" property is omitted or set to null, the server will use the default database name specified at login.

  • If no default database is specified during "createSession", "defaultDatabaseName" will be set to the "defaultDatabaseName" value that is specified in the services.json file.

The "maxRecords" is an optional integer from -1 to 65,535 that sets the maximum number of records to return from an action. It is used in query actions to paginate the query results when returning records directly. The default for most actions is to return 20 records.

Important

-1 returns all records and should be used very carefully because a large query can return so many records that it eventually times out and wastes server and client resources.

Things to know:
  • When present, "maxRecords" works in conjunction with the "skipRecords" (and, when applicable, "reverseOrder") properties to paginate results.

  • "maxRecords" returns an error when "returnCursor" is true.

    Note

    This does not apply to the actions where "returnCursor" is not present.

  • When returning a cursor, retrieve records using the "getRecordsFromCursor" action.

  • A value of 0 for "maxRecords" is not useful because it causes the action to return no records.

  • "maxRecords" is ignored by the "getRecordsByIds" action.

The "ownerName" property is an optional string from 1 to 64 bytes that specifies the account that owns an object.

Things to know:
  • The "ownerName" property is optional and has a dynamic default value.

  • If the "ownerName" property is omitted or set to null, the server uses the value of the "defaultOwnerName" property supplied during the "createSession" action.

  • If the "defaultOwnerName" property is not defined, the server uses the "admin" as the owner name.

  • The owner of an object has administrative rights over that object.

  • The "ownerName" property is a namespace for an object. You can think of it as a container of objects.

    The "ownerName" allows users to use any name for the objects they create — for example, a QA engineer may copy tables into their owner space to run a set of tests.

    It is common for a user to create their own copies of objects from other accounts for testing, troubleshooting, and fixing data. The copied objects can retain the same name because the "ownerName" distinguishes between them.

  • The fully qualified name of an object is the "databaseName", "ownerName", and the object's name, such as "tableName" meaning a FairCom server may contain many tables with the name "mytable" as long as each one is in a different database or in a different owner space.

    For example, an organization often creates different databases for different phases of the development lifecycle, such as dev, test, stage, ua, and prod. Each of these databases contains the same set of objects with the same names. Applications leave the "databaseName" out of their JSON actions and use the "defaultDatabaseName" property to specify the target database.

  • Queries and scripts are often written without specifying "databaseName" and/or "ownerName", allowing queries and scripts to work properly when run in different databases or in different schemas.

The "skipRecords" property is an optional integer from 0 to 9,223,372,036,854,775,807. It is used in query actions to paginate the query results when returning records directly. It defaults to 0.

Things to know:
  • It specifies the number of records to skip over in the results before returning records.

  • It works with "maxRecords" and "reverseOrder".

  • It is ignored when "returnCursor" is true.

    Note

    This does not apply to the actions where "returnCursor" is not present.

The "tableName" property is an optional string that contains the name of an integration table or MQTT topic that holds the topic's messages. It defaults to an empty string.

Things to know:
  • You can use a topic name for an MQTT table because FairCom automatically generates a table name for each topic.

  • A "tableName" cannot begin with a number.

  • It refers to the name of the integration table that stores a topic’s messages and is used to rename that table or assign a new topic to an existing integration table.

  • MQTT automatically creates an integration table for each new topic it receives. Thus, when a message is sent to a topic, FairCom Edge automatically creates a table to hold it.

  • As you refine your integration processes, you may want to rename an integration table to better label the data it holds. You can use the "tableName" property of the "configureTopic" action to rename an integration table.

  • The "alterIntegrationTable" action can also be used to rename an integration table, but it is less convenient because you must know the original name of the integration table.

"result"

Properties summary

Table 2. "result" properties summary

Property

Description

Type

Limits (inclusive)

data

specifies an array or object that the server returns, such as records returned by a query

Note

It is an empty array when there are no results available.

array

Its contents are determined by the action