Skip to main content

"alterSession" (JSON Action)

Alter the settings of a session

The "alterSession" action alters the settings of the session identified by the "authToken" property. It can modify most session settings but cannot modify the "username" nor the "password" properties used to create the session. It cannot turn a temporary session into a permanent session.

The "result" property returned by the server describes the new state of the session that you just changed using the "alterSession" action.

Links: Concepts | Tutorials | FAQs

Request examples

Change timeouts

{
  "api": "admin",
  "action": "alterSession",
  "params": {
    "idleConnectionTimeoutSeconds": 60000,
    "idleCursorTimeoutSeconds": 60000
  },
  "authToken": "replaceWithAuthTokenFromCreateSession"
}
{
  "api": "admin",
  "action": "alterSession",
  "params": {
    "description": "optional user description of session for troubleshooting",
    "defaultApi": "db",
    "defaultDatabaseName": "ctreeSQL",
    "defaultOwnerName": "admin",
    "defaultBinaryFormat": "hex",
    "defaultDebug": "max",
    "defaultResponseOptions": {
      "dataFormat": "objects",
      "numberFormat": "string",
      "binaryFormat": "hex"
    },
    "idleConnectionTimeoutSeconds": 60000,
    "idleCursorTimeoutSeconds": 60000
  },
  "authToken": "replaceWithAuthTokenFromCreateSession"
}
{
  "requestId": "2",
  "api": "admin",
  "action": "alterSession",
  "params": {
    "description": "new description",
    "defaultApi": "db",
    "defaultDebug": "max",
    "defaultDatabaseName": "ctreeSQL",
    "defaultOwnerName": "admin",
    "defaultBinaryFormat": "hex",
    "defaultVariantFormat": "binary",
    "defaultResponseOptions": {
      "dataFormat": "objects",
      "numberFormat": "string",
      "binaryFormat": "hex",
      "variantFormat": "variantObject"
    },
    "idleConnectionTimeoutSeconds": 60000,
    "permanentSession": "true",
    "idleCursorTimeoutSeconds": 60000
  },
  "responseOptions": {
    "dataFormat": "objects",
    "numberFormat": "string",
    "binaryFormat": "hex",
    "variantFormat": "json"
  },
  "apiVersion": "1.0",
  "debug": "max"
}
{
  "result": {
    "username": "ADMIN",
    "description": "My test session",
    "defaultDatabaseName": "ctreeSQL",
    "defaultOwnerName": "admin",
    "defaultBinaryFormat": "hex",
    "defaultVariantFormat": "json",
    "defaultResponseOptions": {
      "binaryFormat": "hex",
      "dataFormat": "objects",
      "numberFormat": "number",
      "variantFormat": "json"
    },
    "idleConnectionTimeoutSeconds": 60000,
    "idleCursorTimeoutSeconds": 60000,
    "defaultApi": "mq",
    "defaultDebug": "max",
    "sessionStartTimestamp": "2023-04-20T18:08:56",
    "sessionLastAccessedTimestamp": "2023-04-20T18:10:22",
    "authToken": "replaceWithAuthTokenFromCreateSession"
  },
  "requestId": "00000006",
  "errorCode": 0,
  "errorMessage": "",
  "authToken": "replaceWithAuthTokenFromCreateSession"
}
{
  "authToken": "invalidAuthtoken",
  "requestId": "00000011",
  "debugInfo": {
    "request": {
      "authToken": "invalidAuthtoken",
      "api": "admin",
      "action": "alterSession",
      "params": {
        "idleConnectionTimeoutSeconds": 60000,
        "idleCursorTimeoutSeconds": 60000
      },
      "requestId": "00000011"
    }
  },
  "errorCode": 12031,
  "errorMessage": "'authToken' does not match any existing session. Use a valid 'authToken' or use 'createSession' to create a valid 'authToken'."
}

The "alterSession" action modifies the settings of an existing session identified by its "authToken". While it can change most session settings, it cannot modify the "username" or "password" used to create the session, nor can it convert a temporary session into a permanent one. The server returns a "result" property describing the session's new state after the changes.

API actionsJSON ADMIN APIadmin session actionalter sessionJSON ActionalterSessionaltersSessionalterSessionssession settingspermanent sessionchange sessionupdate sessionupdate session settingsmanage session settingssession management

The "params" property is an object that contains an action's request parameters as defined by a set of properties. Each action defines its own required and optional properties. See System limits for a comprehensive overview of property requirements and limitations.

Table 1. alterSession "params" property summaries

Property

Description

Default

Type

Limits (inclusive)

defaultApi

(optional) specifies the default value of the "api" property when "api" is omitted from an action request.

FairCom DB defaults to "db"
FairCom Edge defaults "hub"
FairCom MQ defaults "mq"

string enum

"admin"
"hub"
"mq"
"db"

defaultBinaryFormat

(optional) specifies the default value for the "binaryFormat" property, which tells the server how to parse binary data from the client when the binary format is not specified in the action request.

"hex"

string

One of the following: "base64", "hex", or "byteArray".

defaultDatabaseName

(optional) specifies the default value of the "databaseName" property.

FairCom DB defaults to "ctreeSQL"
FairCom Edge defaults to "faircom"
FairCom MQ defaults to "faircom"

string

1 to 64 bytes

defaultDebug

(optional) specifies the default value of the "debug" property for all requests in a session.

"max"

string enum

"none"
"max"

defaultOwnerName

(optional) specifies the initial value of the "defaultOwnerName" property used by JSON APIs and FairCom's web application.

"admin"

string

1 to 64 bytes

defaultVariantFormat

(optional) specifies the variant format the server uses when the user omits the "variantFormat" property in a JSON action request.

"json"

string

"json"
"binary"
"string"
"variantObject"

defaultResponseOptions

(optional) specifies a default value for "responseOptions" that is used by default in all other action calls. "includeFields" and "excludeFields" are mutually exclusive and "includePaths" and "excludePaths" are mutually exclusive.

{}

object

Zero or more of the following properties:

"binaryFormat"
"dataFormat"
"numberFormat"
defaultResponseOptions
.binaryFormat

(optional) specifies how binary values are returned.

"hex"

string

One of the following: "base64", "hex", or "byteArray".

defaultResponseOptions
.dataFormat

(optional) specifies what format the results will be returned in.

"arrays"

string

"default"
"arrays"
"objects"
defaultResponseOptions
.numberFormat

(optional) specifies how numbers are formatted in the JSON response message.

"number"

string

"number"
"string"
defaultResponseOptions
.variantFormat

(optional) tells the server how to interpret the variant-type data included in the request.

"json"

string

"json"
"binary"
"string"
"variantObject"

defaultRetentionPeriod

(optional) specifies how many retention units will be retained if the "retentionPeriod" property is omitted.

4

integer

1 to 100

defaultRetentionPolicy

(optional) specifies the default way in which messages are persisted if the "retentionPolicy" property is omitted.

"autoPurge"

string enum

"doNotPersist"
"neverPurge"
"autoPurge"

defaultRetentionUnit

(optional) specifies the default unit of time after which the expired messages will be purged if the "retentionUnit" property is omitted.

"week"

string enum

"minute"
"hour"
"day"
"week"
"month"
"year"
"forever"

description

(optional) describes an object for later identification.

""

string

0 to 65,500 bytes

idleConnectionTimeoutSeconds

(optional) specifies the number of seconds that a session with no activity will stay open.

3600

integer

0 to 2147483647

idleCursorTimeoutSeconds

(optional) specifies the number of seconds to keep a cursor open.

600

integer

0 to 2147483647

transformBufferInitialBytes

(optional) specifies the number of bytes for the session to allocate initially for its transform buffer.

0

integer

0 or more bytes



The "defaultApi" property specifies the default value of the "api" property when it is omitted from an action request. The default value for "defaultApi" is "admin", which is the API used by all session actions.

  "params": {
    "username": "CHANGE",
    "password": "CHANGE",
    "description": "optional user description of session for troubleshooting",
    "defaultApi": "db",
    "defaultDebug": "max",
    "defaultDatabaseName": "ctreeSQL",
    "defaultOwnerName": "admin",
    "defaultBinaryFormat": "hex"
    },

The "defaultDatabaseName" property is an optional string that specifies which database name to use when the "databaseName" property is omitted.

  "params": {
    "username": "CHANGE",
    "password": "CHANGE",
    "description": "optional user description of session for troubleshooting",
    "defaultApi": "db",
    "defaultDebug": "max",
    "defaultDatabaseName": "ctreeSQL",
    "defaultOwnerName": "admin",
    "defaultBinaryFormat": "hex"
    },

"defaultDebug" is an optional string that defines the default value of the "debug" property for all requests in a session. It defaults to "max".

Important

This is different than the "debug" property in that the "debug" property can be universally used in any action while the "defaultDebug" property is only set in the "createSession" action and sets the "debug" property for any action run using the session being created.

  • Possible values include:

    • "none"

    • "max"

  • If "defaultDebug" is omitted or set to null, it defaults to "max".

    This causes the server to include the "debugInfo" property in the response.

    This setting is typically used in development environments and for temporarily troubleshooting issues in production environments.

  • For maximum performance set "defaultDebug" to "none" .

    This causes the server to omit the "debugInfo" property in the response.

    This setting is typically used in production and staging environments where it is desirable to have maximum performance and minimal network traffic.

The "defaultOwnerName" property is an optional string that is supplied at "createSession". It is used by the "ownerName" property which specifies the owner account name. It defaults to the "username". When "ownerName" is omitted, the server sets "ownerName" to the value of "defaultOwnerName". However, if "defaultOwnerName" is set to the empty string, then the "ownerName" is set to the empty string.

  • See Object owner in the JSON DB Concepts section for an explanation of how to use the "defaultOwnerName" property to specify the owner of objects created in the session

  • When "ownerName" is omitted the server uses the "defaultOwnerName" property value set during login.

  • In "createSession" and "alterSession" when "defaultOwnerName" is omitted or set to null:

    • In the JSON DB API, the server sets "defaultOwnerName" to the "username" of the logged-in user. Thus, by default, the logged-in account owns the objects it creates.

    • In the JSON Hub API and JSON MQ API, the server sets "defaultOwnerName" to "admin" allowing the server to own the objects it creates.

  • Actions that create objects, such as "createTable" and "createIntegrationTable", can omit the "ownerName" property making the server set "ownerName" to the value of "defaultOwnerName".

  • When an action that creates an object sets the "ownerName" property to a valid account name, the specified account owns the created object and an account that owns an object has full management rights over the object. You can use object ownership as a simple way to control access to objects.

  • When "ownerName" is set to the empty string, then no account owns the object. Unowned objects can be managed by administrator accounts and by accounts assigned to roles that grant access rights to the object making it useful when you want to prevent an account from owning an object and inheriting full management rights to that object.

The "defaultResponseOptions" property is a "responseOptions" object. It defines a default value for "responseOptions" that is used by default in all other action calls. It defaults to an empty object.

  • JSON NAV allows you to choose how your program detects errors. By default, all error properties are included in each response – unless you override this behavior as shown in the example.

  • The example omits the error object in all responses which makes it easier for statically typed languages, such as C, C++, Java, C#, and VB, because they prefer properties to always be present. To help these languages, the "errorCode", "errorMessage", and "errorData" properties are always present whether there is an error or not.

Example

 "defaultResponseOptions": {
      "binaryFormat": "hex",
      "dataFormat": "objects",
      "numberFormat": "number",
      "variantFormat": "json"
    }

"variantFormat"

The "variantFormat" property tells the server how to format the values of variant fields in its response to your request.

The "numberFormat" property is an optional, case-insensitive string enum. It defines the format of JSON numbers. The default value for "numberFormat" is the "defaultNumberFormat" defined in the "createSession" or "alterSession" actions. If it is omitted there, it defaults to the value of the "defaultNumberFormat" property in the <faircom>/config/services.json file.

When "numberFormat" occurs in "mapOfPropertiesToFields", it tells the server how to encode or decode a number assigned to a JSON property.

For example, including "numberFormat" in a "tableFieldsToJson" transform step controls if the server encodes a number in a JSON property as a number or a number embedded in a string.

Possible values:
  • "number"

    This causes the server to return numeric values as JSON numbers, such as -18446744073709551616.000144722494 .

    This is most efficient.

    JSON represents numbers are base-ten numbers that may have any number of digits.

    Large numbers, such as 18446744073709551616.000144722494 are known to cause problems with JSON parsers and some programming languages, such as JavaScript, which are limited to the smaller range and binary rounding errors of IEEE floating point numbers.

  • "string"

    This returns the server to embed numeric values in JSON strings, such as "18446744073709551616.000144722494" .

    This is slightly less efficient because it includes two extra double quote characters

    Returning numbers embedded in strings ensures JSON parsers and programming languages will not automatically convert the number to a numeric representation that loses precision, introduces rounding errors, truncates values, or generates errors. This allows your application to control how numbers are processed.

  • Omitted or set to null

    This defaults to "number".

Example request

{
  "action": "someAction",
  "responseOptions":
  {
    "numberFormat": "string"
  },
  "authToken": "replaceWithAuthTokenFromCreateSession"
}

The "variantFormat" property tells the server how to interpret the variant data included in a JSON Action request.

The "defaultRetentionPeriod" property specifies how many retention units will be retained if the "retentionPeriod" property is omitted. It is used in tandem with "defaultRetentionUnit", the retention period describing how many units, and the retention unit describing what kind of unit of measurement. For example, if the "defaultRetentionPeriod" is set to 4, and the "defaultRetentionUnit" is set to "week", the server will purge messages once 4 weeks have passed by default.

  "params": {
    "defaultRetentionPolicy": "autoPurge",
    "defaultRetentionUnit": "week",
    "defaultRetentionPeriod": 4
  },

The "defaultRetentionPolicy" property specifies the default way in which messages are persisted if the "retentionPolicy" property is omitted. Using this property, you can configure messages to persist indefinitely, be purged according to the retention unit and period, or be immediately purged by default.

  "params": {
    "defaultRetentionPolicy": "autoPurge",
    "defaultRetentionUnit": "week",
    "defaultRetentionPeriod": 4
  },

The "defaultRetentionUnit" property specifies the type of retention unit if the "retentionUnit" property is omitted. It is used in tandem with "defaultRetentionUnit", the retention period describing how many units, and the retention unit describing what kind of unit of measurement. For example, if the "defaultRetentionPeriod" is set to 4, and the "defaultRetentionUnit" is set to "week", the server will purge messages once 4 weeks have passed by default.

  "params": {
    "defaultRetentionPolicy": "autoPurge",
    "defaultRetentionUnit": "week",
    "defaultRetentionPeriod": 4
  },

The "defaultVariantFormat" property sets the default value of the "variantFormat" property when a JSON Action request does not include it.

The "description" property is an optional string that allows you to describe an object for later identification.

  "params": {
    "username": "CHANGE",
    "password": "CHANGE",
    "description": "optional user description of session for troubleshooting",
    "defaultApi": "db",
    "defaultDebug": "max",
    "defaultDatabaseName": "ctreeSQL",
    "defaultOwnerName": "admin",
    "defaultBinaryFormat": "hex"
    },

The "idleConnectionTimeoutSeconds" property is an optional integer from 0 to 2147483647. It is the number of seconds that a session with no activity will stay open.

A value of 0 keeps a session open indefinitely.

The "idleCursorTimeoutSeconds" property is an optional integer from 0 to 2147483647. It is the number of seconds to keep a cursor open.

  • Each time a cursor retrieves records, the cursor timer restarts.

  • A value of -1 keeps a cursor open indefinitely.

  • A value of 0 immediately closes a cursor after the current operation.

The "transformBufferInitialBytes" property is optional and defaults to 0. It is a positive integer that specifies the number of bytes for the session to allocate initially for its transform buffer. Omit this property or set it to 0 when you do not plan on using the "transformCodeName" property to transform the JSON returned from the "getRecords..." actions. If you plan on transforming the JSON, you can set the "transformBufferInitialBytes" property to the number of bytes that you anticipate the server will need to store the results of each transform. If the server needs more memory, it automatically increases the buffer size; thus, this property is an optimization that helps prevent the server from doing expensive memory allocations.

Table 2. "responseOptions" property summaries

Property

Description

Default

Type

Limits (inclusive)

binaryFormat

specifies how binary values are returned

"hex"

string

One of the following: "base64", "hex", or "byteArray".

dataFormat

specifies what format the results will be returned in

"arrays"

string

"default"
"arrays"
"objects"

excludeFields

(optional) specifies which fields are excluded in the response message

[]

When the array is empty or the property is not specified, the includeFields behavior applies

array

excludePaths

specifies which paths are excluded in the response message

[]

When the array is empty or the property is not specified, the includePaths behavior applies

array

includeFields

(optional) specifies which fields are returned in the response message

[]

When the array is empty or the property is not specified, all fields are returned

array

includePaths

specifies which paths are included in the response message

[]

When the array is empty or the property is not specified, all paths are returned

array

numberFormat

specifies how numbers are formatted in the JSON response message

"number"

string

"number"
"string"

omit

specifies which properties are excluded in the response message

{}

object

variantFormat

(optional) specifies how the server will represent the values of variant fields in its response to your request

"json"

string

"json"
"binary"
"string"
"variantObject"


The "numberFormat" property is an optional, case-insensitive string enum. It defines the format of JSON numbers. The default value for "numberFormat" is the "defaultNumberFormat" defined in the "createSession" or "alterSession" actions. If it is omitted there, it defaults to the value of the "defaultNumberFormat" property in the <faircom>/config/services.json file.

When "numberFormat" occurs in "mapOfPropertiesToFields", it tells the server how to encode or decode a number assigned to a JSON property.

For example, including "numberFormat" in a "tableFieldsToJson" transform step controls if the server encodes a number in a JSON property as a number or a number embedded in a string.

Possible values:
  • "number"

    This causes the server to return numeric values as JSON numbers, such as -18446744073709551616.000144722494 .

    This is most efficient.

    JSON represents numbers are base-ten numbers that may have any number of digits.

    Large numbers, such as 18446744073709551616.000144722494 are known to cause problems with JSON parsers and some programming languages, such as JavaScript, which are limited to the smaller range and binary rounding errors of IEEE floating point numbers.

  • "string"

    This returns the server to embed numeric values in JSON strings, such as "18446744073709551616.000144722494" .

    This is slightly less efficient because it includes two extra double quote characters

    Returning numbers embedded in strings ensures JSON parsers and programming languages will not automatically convert the number to a numeric representation that loses precision, introduces rounding errors, truncates values, or generates errors. This allows your application to control how numbers are processed.

  • Omitted or set to null

    This defaults to "number".

Example request

{
  "action": "someAction",
  "responseOptions":
  {
    "numberFormat": "string"
  },
  "authToken": "replaceWithAuthTokenFromCreateSession"
}

The "variantFormat" property tells the server how to format the values of variant fields in its response to your request.

The "result" property is a required object set by the server that contains the result of an action.

Table 3. alterSession "result" property summaries

Property

Description

Type

Contents

authToken

signifies that the client is authenticated and authorized

string

0 to 255 bytes

defaultApi

indicates the value of the "api" property when "api" is omitted from an action request. 

string enum

"admin"
"hub"
"mq"
"db"

defaultBinaryFormat

specifies the default value for the "binaryFormat" property, which tells the server how to parse binary data from the client when the binary format is not specified in the action request.

string

"base64"
"hex"
"byteArray"

defaultDatabaseName

specifies the default value of the "databaseName" property.

string

1 to 64 bytes

defaultDebug

indicates the default value of the "debug" property for all requests in a session.

string enum

"none"
"max"

defaultOwnerName

specifies the initial value of the "defaultOwnerName" property used by JSON APIs and FairCom's web application.

string

1 to 64 bytes

defaultResponseOptions

specifies a default value for "responseOptions" that is used by default in all other action calls. "includeFields" and "excludeFields" are mutually exclusive and "includePaths" and "excludePaths" are mutually exclusive.

object

"includeFields"
"excludeFields"
"includePaths"
"excludePaths"
"omit"
"numberFormat"
"dataFormat"
defaultResponseOptions
.binaryFormat

specifies how binary values are returned.

string enum

"base64"
"hex"
"byteArray"
defaultResponseOptions
.dataFormat

specifies what format the results will be returned in.

string enum

"arrays"
"default"
"objects"
defaultResponseOptions
.numberFormat

specifies how numbers are formatted in the JSON response message.

string enum

"number"
"string"
defaultResponseOptions
.variantFormat

indicates how the server will interpret the variant-type data included in the request.

string enum

"json"
"binary"
"string"
"variantObject"

defaultRetentionPeriod

indicates how many retention units will be retained if the "retentionPeriod" property is omitted.

integer

1 to 100

defaultRetentionPolicy

indicates the default way in which messages are persisted if the "retentionPolicy" property is omitted.

string enum

"doNotPersist"
"neverPurge"
"autoPurge"

defaultRetentionUnit

indicates the default unit of time after which the expired messages will be purged if the "retentionUnit" property is omitted.

string enum

"minute"
"hour"
"day"
"week"
"month"
"year"
"forever"

defaultVariantFormat

indicates the variant format the server uses when the user omits the "variantFormat" property in a JSON action request.

string enum

"json"
"binary"
"string"
"variantObject"

description

(optional) describes an object for later identification.

string

0 to 65,500 bytes

idleConnectionTimeoutSeconds

(optional) specifies the number of seconds that a session with no activity will stay open.

integer

0 to 2147483647

idleCursorTimeoutSeconds

(optional) specifies the number of seconds to keep a cursor open.

integer

0 to 2147483647

permanentSession

indicates if the session is persisted.

boolean

true
false

serverVersion

indicates the version of the server the request was made to.

string

The name of the version of the FairCom server to which the request was made.

sessionLastAccessedTimestamp

indicates the date/time when the session was last accessed.

timestamp

An ISO 8601 timestamp

sessionStartTimestamp

indicates the date/time when the session was initiated.

timestamp

An ISO 8601 timestamp

transformBufferInitialBytes

indicates the number of bytes for the session to allocate initially for its transform buffer.

integer

0 or more bytes

username

specifies the account name of a user or application.

string

1 to 64 bytes



The "authToken" property signifies that the client is authenticated and authorized. It is required.

  • It is supplied by the server in response to the connect action.

  • Clients must include it in all subsequent requests to validate that they are authenticated and authorized. If the client does not supply the correct values, the server returns an unauthorized error.

The "defaultApi" property specifies the default value of the "api" property when it is omitted from an action request. The default value for "defaultApi" is "admin", which is the API used by all session actions.

  "params": {
    "username": "CHANGE",
    "password": "CHANGE",
    "description": "optional user description of session for troubleshooting",
    "defaultApi": "db",
    "defaultDebug": "max",
    "defaultDatabaseName": "ctreeSQL",
    "defaultOwnerName": "admin",
    "defaultBinaryFormat": "hex"
    },

The "defaultDatabaseName" property is an optional string that specifies which database name to use when the "databaseName" property is omitted.

  "params": {
    "username": "CHANGE",
    "password": "CHANGE",
    "description": "optional user description of session for troubleshooting",
    "defaultApi": "db",
    "defaultDebug": "max",
    "defaultDatabaseName": "ctreeSQL",
    "defaultOwnerName": "admin",
    "defaultBinaryFormat": "hex"
    },

"defaultDebug" is an optional string that defines the default value of the "debug" property for all requests in a session. It defaults to "max".

Important

This is different than the "debug" property in that the "debug" property can be universally used in any action while the "defaultDebug" property is only set in the "createSession" action and sets the "debug" property for any action run using the session being created.

  • Possible values include:

    • "none"

    • "max"

  • If "defaultDebug" is omitted or set to null, it defaults to "max".

    This causes the server to include the "debugInfo" property in the response.

    This setting is typically used in development environments and for temporarily troubleshooting issues in production environments.

  • For maximum performance set "defaultDebug" to "none" .

    This causes the server to omit the "debugInfo" property in the response.

    This setting is typically used in production and staging environments where it is desirable to have maximum performance and minimal network traffic.

The "defaultOwnerName" property is an optional string that is supplied at "createSession". It is used by the "ownerName" property which specifies the owner account name. It defaults to the "username". When "ownerName" is omitted, the server sets "ownerName" to the value of "defaultOwnerName". However, if "defaultOwnerName" is set to the empty string, then the "ownerName" is set to the empty string.

  • See Object owner in the JSON DB Concepts section for an explanation of how to use the "defaultOwnerName" property to specify the owner of objects created in the session

  • When "ownerName" is omitted the server uses the "defaultOwnerName" property value set during login.

  • In "createSession" and "alterSession" when "defaultOwnerName" is omitted or set to null:

    • In the JSON DB API, the server sets "defaultOwnerName" to the "username" of the logged-in user. Thus, by default, the logged-in account owns the objects it creates.

    • In the JSON Hub API and JSON MQ API, the server sets "defaultOwnerName" to "admin" allowing the server to own the objects it creates.

  • Actions that create objects, such as "createTable" and "createIntegrationTable", can omit the "ownerName" property making the server set "ownerName" to the value of "defaultOwnerName".

  • When an action that creates an object sets the "ownerName" property to a valid account name, the specified account owns the created object and an account that owns an object has full management rights over the object. You can use object ownership as a simple way to control access to objects.

  • When "ownerName" is set to the empty string, then no account owns the object. Unowned objects can be managed by administrator accounts and by accounts assigned to roles that grant access rights to the object making it useful when you want to prevent an account from owning an object and inheriting full management rights to that object.

The "defaultResponseOptions" property is a "responseOptions" object. It defines a default value for "responseOptions" that is used by default in all other action calls. It defaults to an empty object.

  • JSON NAV allows you to choose how your program detects errors. By default, all error properties are included in each response – unless you override this behavior as shown in the example.

  • The example omits the error object in all responses which makes it easier for statically typed languages, such as C, C++, Java, C#, and VB, because they prefer properties to always be present. To help these languages, the "errorCode", "errorMessage", and "errorData" properties are always present whether there is an error or not.

Example

 "defaultResponseOptions": {
      "binaryFormat": "hex",
      "dataFormat": "objects",
      "numberFormat": "number",
      "variantFormat": "json"
    }

"variantFormat"

The "variantFormat" property tells the server how to format the values of variant fields in its response to your request.

The "numberFormat" property is an optional, case-insensitive string enum. It defines the format of JSON numbers. The default value for "numberFormat" is the "defaultNumberFormat" defined in the "createSession" or "alterSession" actions. If it is omitted there, it defaults to the value of the "defaultNumberFormat" property in the <faircom>/config/services.json file.

When "numberFormat" occurs in "mapOfPropertiesToFields", it tells the server how to encode or decode a number assigned to a JSON property.

For example, including "numberFormat" in a "tableFieldsToJson" transform step controls if the server encodes a number in a JSON property as a number or a number embedded in a string.

Possible values:
  • "number"

    This causes the server to return numeric values as JSON numbers, such as -18446744073709551616.000144722494 .

    This is most efficient.

    JSON represents numbers are base-ten numbers that may have any number of digits.

    Large numbers, such as 18446744073709551616.000144722494 are known to cause problems with JSON parsers and some programming languages, such as JavaScript, which are limited to the smaller range and binary rounding errors of IEEE floating point numbers.

  • "string"

    This returns the server to embed numeric values in JSON strings, such as "18446744073709551616.000144722494" .

    This is slightly less efficient because it includes two extra double quote characters

    Returning numbers embedded in strings ensures JSON parsers and programming languages will not automatically convert the number to a numeric representation that loses precision, introduces rounding errors, truncates values, or generates errors. This allows your application to control how numbers are processed.

  • Omitted or set to null

    This defaults to "number".

Example request

{
  "action": "someAction",
  "responseOptions":
  {
    "numberFormat": "string"
  },
  "authToken": "replaceWithAuthTokenFromCreateSession"
}

The "variantFormat" property tells the server how to format the values of variant fields in its response to your request.

The "defaultRetentionPeriod" property specifies how many retention units will be retained if the "retentionPeriod" property is omitted. It is used in tandem with "defaultRetentionUnit", the retention period describing how many units, and the retention unit describing what kind of unit of measurement. For example, if the "defaultRetentionPeriod" is set to 4, and the "defaultRetentionUnit" is set to "week", the server will purge messages once 4 weeks have passed by default.

  "params": {
    "defaultRetentionPolicy": "autoPurge",
    "defaultRetentionUnit": "week",
    "defaultRetentionPeriod": 4
  },

The "defaultRetentionPolicy" property specifies the default way in which messages are persisted if the "retentionPolicy" property is omitted. Using this property, you can configure messages to persist indefinitely, be purged according to the retention unit and period, or be immediately purged by default.

  "params": {
    "defaultRetentionPolicy": "autoPurge",
    "defaultRetentionUnit": "week",
    "defaultRetentionPeriod": 4
  },

The "defaultRetentionUnit" property specifies the type of retention unit if the "retentionUnit" property is omitted. It is used in tandem with "defaultRetentionUnit", the retention period describing how many units, and the retention unit describing what kind of unit of measurement. For example, if the "defaultRetentionPeriod" is set to 4, and the "defaultRetentionUnit" is set to "week", the server will purge messages once 4 weeks have passed by default.

  "params": {
    "defaultRetentionPolicy": "autoPurge",
    "defaultRetentionUnit": "week",
    "defaultRetentionPeriod": 4
  },

The "defaultVariantFormat" property sets the default value of the "variantFormat" property when a JSON Action request does not include it.

The "description" property is an optional string that allows you to describe an object for later identification.

  "params": {
    "username": "CHANGE",
    "password": "CHANGE",
    "description": "optional user description of session for troubleshooting",
    "defaultApi": "db",
    "defaultDebug": "max",
    "defaultDatabaseName": "ctreeSQL",
    "defaultOwnerName": "admin",
    "defaultBinaryFormat": "hex"
    },

The "idleConnectionTimeoutSeconds" property is an optional integer from 0 to 2147483647. It is the number of seconds that a session with no activity will stay open.

A value of 0 keeps a session open indefinitely.

The "idleCursorTimeoutSeconds" property is an optional integer from 0 to 2147483647. It is the number of seconds to keep a cursor open.

  • Each time a cursor retrieves records, the cursor timer restarts.

  • A value of -1 keeps a cursor open indefinitely.

  • A value of 0 immediately closes a cursor after the current operation.

The "permanentSession" property is an optional Boolean that indicates if a session is permanent. It defaults to false.

Important

Before you can create permanent sessions, you must add "enablePermanentJsonApiSessions": true to the "jsonActionApiDefaults" section of the <faircom>/config/services.json file.

If "permanentSession" is set to true when "createSession" is called, the server sets the authtoken as permanent. The authtoken is associated with the settings and authorizations of the user who created the session. It is always valid even after the server restarts. A permanent authToken works like an API Key and authenticates an application without the need for a username/password or a client certificate. Multiple applications can use the same permanent authToken.

Warning

A permanent "authToken" is potentially less secure than a temporary one.

  • A permanent "authToken" never becomes invalid, which makes it easier for an attacker to find it using brute force.

  • A permanent "authToken" is persisted by an application, which increases the opportunity for an attacker to find it.

  • A permanent "authToken" allows each application server to share the same session, which potentially allows an attacker to change session settings for all application servers.

  • When you set the "permanentSession" property to true in "createSession" , it creates a permanent session and returns a permanent "authToken" .

  • Developers and applications can use a permanent authToken in JSON actions without needing to call createSession to get a temporary authToken.

  • You must protect a permanent "authToken" as you would a password or API key because it represents a permanently authenticated server session.

  • A permanent session does not expire. You can also prevent a temporary session from expiring by setting its "idleConnectionTimeoutSeconds" property to 0.

  • A permanent "authToken" uses the authorization and settings of the account that originally created the session. All actions performed in the session are performed using that account's authorizations, and account settings, such as its default database and owner.

  • You can use "alterSession" to modify the settings of a permanent session, but you cannot use it to turn a temporary session into a permanent session.

  • If multiple application servers use the same permanent "authToken", they share the same permanent session settings. Consider the following:

    • If one application server uses "alterSession" to change a permanent session's settings, the other application servers automatically use the new settings. To avoid confusion and errors, applications must specify all JSON action property values and not rely on session defaults.

    • You cannot use different sessions to determine which app server executes an action. This makes troubleshooting more difficult.

    • An application must create and use a transaction to protect the visibility and integrity of multiple operations from other applications. This is true for permanent and temporary sessions.

  • The FairCom server securely stores each permanent "authToken" in the encrypted faircom.fcs file.

The "serverVersion" property indicates which version of the FairCom server the request was made to.

  "result": {
    "sessionStartTimestamp": "2025-08-28T15:44:56",
    "sessionLastAccessedTimestamp": "2025-08-28T18:07:07",
    "defaultRetentionPolicy": "autoPurge",
    "defaultRetentionUnit": "week",
    "defaultRetentionPeriod": 4,
    "serverVersion": "FairCom EDGE Server - V4.2.4.109(Build-250819)"
  },

The "sessionLastAccessedTimestamp" property indicates the date/time when the session was last accessed.

"result": {
  "sessionStartTimestamp": "2025-08-27T20:26:25",
  "sessionLastAccessedTimestamp": "2025-08-27T20:56:25"
  },

The "sessionStartTimestamp" property indicates the date/time when the session was first initialized.

"result": {
  "sessionStartTimestamp": "2025-08-27T20:26:25",
  "sessionLastAccessedTimestamp": "2025-08-27T20:56:25"
  },

The "transformBufferInitialBytes" property is optional and defaults to 0. It is a positive integer that specifies the number of bytes for the session to allocate initially for its transform buffer. Omit this property or set it to 0 when you do not plan on using the "transformCodeName" property to transform the JSON returned from the "getRecords..." actions. If you plan on transforming the JSON, you can set the "transformBufferInitialBytes" property to the number of bytes that you anticipate the server will need to store the results of each transform. If the server needs more memory, it automatically increases the buffer size; thus, this property is an optimization that helps prevent the server from doing expensive memory allocations.

The "username" property is a required string from 1 to 64 bytes. It is the account name of a user or application.

  • It is required by the "createSession" action for authentication.

  • All API actions are performed in the context of the account identified by "username". For example, all tables created by an account are owned by the account. All queries use tables owned by the account.

  • In JSON DB API and JSON Hub API, use the "ownerName" property to cause an action to use a different account name than the value of "username". This allows an account to use tables created by another account and to create tables that are owned by another account.

  • Unlike other property names, such as "databaseName", "username" is all lowercase.

  • A zero-length username is invalid.

Note

See System limits for requirements of this and all other system properties.