Skip to main content

"listIndexes"

JSON DB "listIndexes" action returns indexes 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

{
  "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"
}
{
  "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": ""
}

Use the listIndexes API action to list indexes in the specified database table that the logged-in user is allowed to see

API actionsJSON DB APIjsonActionlist indexeslistIndexes

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.

  • 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.

  • 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.

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.

  • 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 a string containing the name of a table.

  • A table name may contain up to 64 ASCII characters and must not start with a number.

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. It is always included in a response but contains an empty array when no results are available.

array

Its contents are determined by the action