Skip to main content

"describeIntegrationTables"

JSON hub "describeIntegrationTable action returns all available information about each specified integration table in FairCom Edge

The "describeIntegrationTables" action returns all available information about each specified integration table.

Request examples

Describe a table request

{
  "api": "hub",
  "apiVersion": "1.0",
  "requestId": "optionalUniquerequestIdFromTheClient",
  "authToken": "anAuthorizationTokenFromTheServer",
  "action": "describeIntegrationTables",
  "params": {
    "tables": 
    [
      {
        "databaseName": "faircom",
        "ownerName": "admin",
        "tableName": "mqtt_msg_faircomadmin_topics"
      }
    ]
  }
}
{
  "requestId": "optionalUniqueRequestIdFromTheClient",
  "authToken": "anAuthorizationTokenFromTheServer",
  "api": "hub",
  "action": "describeIntegrationTables",
  "params": {
    "tables": [
      {
        "databaseName": "faircom",
        "ownerName": "admin",
        "tableName": "mqtt_msg_faircomadmin_topics"
      }
    ]
  },
  "apiVersion": "1.0",
  "debug": "max"
}
{
    "authToken": "anAuthorizationTokenFromTheServer",
    "result": {
        "data": [
            {
                "databaseName": "faircom",
                "ownerName": "admin",
                "tableName": "mqtt_msg_faircomadmin_topics",
                "fields": [],
                "retentionPolicy": "autoPurge",
                "retentionPeriod": 30,
                "retentionUnit": "day"
            }
        ]
    },
    "requestId": "00000017",
    "errorCode": 0,
    "errorMessage": ""
}

Use the describeIntegrationTables JSON API action to return all available information about each specified integration table in FairCom edge

JSON hub APIAPI actionsjsonActionintegration tables actionsdescribe integration tabledescribeIntegrationTables

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

Properties summary

Table 1. "params" properties summary

Property

Description

Default

Type

Limits (inclusive)

tables

contains an array of objects [each object identifies a table]

Defaults to a single default object.

array

none

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

tables
.ownerName

specifies the unique name of a schema in a database

""

string

1 to 64 bytes

tables
.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 "ownerName" property is an optional string from 1 to 64 bytes that specifies the account that owns an object.

  • 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 "tableName" property is a string containing the name of an integration table. In FairCom Edge, you can use "createInput" to collect data from a device, and FairCom Edge will store the data in the specified integration table. You can also use "createOutput" to connect an integration table to an output so FairCom Edge will push inserted data to external systems, such as REST endpoints and ThingWorx.

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

  • You must specify a non-empty string for an integration table name.

  • When creating an integration table, specify a non-empty string for a table name.

  • FairCom Edge and FairCom MQ automatically create an integration table for each new MQTT topic they process. The first characters in the table name are "mqtt_msg_" followed by the topic name. Because an MQTT topic can be 65500 bytes and a table name can be 64 bytes, the server may abbreviate the topic name.

  • To better identify the data it holds, rename an integration using the "tableName" and "newTableName" properties of the "alterIntegrationTable" action.

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 an empty array when no results are available.

array

Its contents are determined by the action

dataFormat

specifies the format of the data in the "data" property

string

"autoDetect"
"arrays"
"objects"


The "dataFormat" property is an optional, case-insensitive string enum that defines the format of the response in the "data" property. The default format is an array of arrays. The alternative is an array of objects. The default for "dataFormat" can be changed during a "createSession" action by assigning a different value to the "dataFormat" property in "defaultResponseOptions".

There are three different (but similar) versions of the "dataFormat" property:

Two of those versions occur in a request and another occurs in a response. They all indicate how data is formatted.

  • "dataFormat" in the request inside "responseOptions" determines how the "data" property in the response is formatted.

    Possible values include:

    • "arrays"

      This is the default and causes the server to return results as an array of arrays, which is the most efficient.

    • "objects"

      This returns results as an array of objects. This is less efficient but is simpler to generate, read, and troubleshoot.

  • "dataFormat" in the request in the "params" object notifies the server how the "sourceData" property is formatted in the request. This version is rarely used because of the default "autoDetect" behavior.

    Possible values include:

    • "arrays"

      This causes the server to return results as an array of arrays, which is the most efficient.

    • "objects"

      This returns results as an array of objects. This is less efficient but is simpler to generate, read, and troubleshoot.

    • "autoDetect"

      This is the default and causes the server to automatically detect the format of the data in the "sourceData" property.

  • "dataFormat" in the response shows the client how the server formatted the "data" property.

    Possible values include:

    • "arrays"

      This is the default and causes the server to return results as an array of arrays, which is the most efficient.

    • "objects"

      This returns results as an array of objects. This is less efficient but is simpler to generate, read, and troubleshoot.