"alterSession"
alterSession alters the settings of the session identified by the authToken property.
The "alterSession"
action alters the settings of the session identified by the "authToken"
property.
Things to know
"alterSession"
can modify most session settings but cannot modify the"username"
nor the"password"
properties used to create the session.The
"result"
property returned by the server describes the new state of the session that you just changed using the"alterSession"
action.
Request examples
Change timeouts request example
{ "api": "admin", "action": "alterSession", "authToken": "replaceWithValidAuthtoken", "params": { "idleConnectionTimeoutSeconds": 60000, "idleCursorTimeoutSeconds": 60000 } }
{ "api": "admin", "action": "alterSession", "authToken": "replaceWithValidAuthtoken", "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 } }
Response examples
{ "authToken": "replaceWithValidAuthtoken", "result": { "authToken": "replaceWithValidAuthtoken", "username": "ADMIN", "description": "My test session", "defaultDatabaseName": "ctreeSQL", "defaultOwnerName": "admin", "defaultBinaryFormat": "hex", "defaultResponseOptions": { "binaryFormat": "hex", "dataFormat": "objects", "numberFormat": "number" }, "idleConnectionTimeoutSeconds": 60000, "idleCursorTimeoutSeconds": 60000, "defaultApi": "mq", "defaultDebug": "max", "sessionStartTimestamp": "2023-04-20T18:08:56", "sessionLastAccessedTimestamp": "2023-04-20T18:10:22" }, "requestId": "00000006", "errorCode": 0, "errorMessage": "" }
{ "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'." }
"params"
The "params"
property is an object that contains an action's parameters. Each action defines its own required and optional properties.
Property summary
"params"
property summariesProperty | Description | Default | Type | Limits (inclusive) | |||||||
---|---|---|---|---|---|---|---|---|---|---|---|
| defines the default value of the |
| string enum |
| |||||||
| defines the default value for the |
| string enum |
| |||||||
| defines the default value of the |
| string |
| |||||||
specifies the initial value of the |
| string |
| ||||||||
defines a default value for |
| object | One or more of the following:
| ||||||||
| allows the client to describe an object for later identification |
| string |
| |||||||
contains the number of seconds that a session with no activity will stay open |
| integer |
| ||||||||
contains the number of seconds to keep a cursor open |
| integer |
|
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.
When
"ownerName"
is omitted the server uses the"defaultOwnerName"
property value set during login.In
"createSession"
and"alterSession"
when"defaultOwnerName"
is omitted or set tonull
: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 and omitting the error object 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": { "dataFormat": "objects", "numberFormat": "string", "binaryFormat": "hex" }
Property summary
"defaultResponseOptions"
property summariesProperty | Description | Default | Type | Limits (inclusive) | |||
---|---|---|---|---|---|---|---|
determines how binary values are returned |
| string |
| ||||
defines what format the results will be returned in |
| string |
| ||||
| controls how numbers are formatted in the JSON response message |
| string |
|
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"
.
"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.
The "idleConnectionTimeoutSeconds"
property is an optional integer from 0
to 2,147,483,647
. It is the number of seconds that a session with no activity will stay open.
Each time a session executes an operation, the session timer restarts.
A value of
0
keeps a session open indefinitely.
The "idleCursorTimeoutSeconds"
property is an optional integer from 0
to 2,147,483,647
. 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.
"result"
The "result"
property is a required object set by the server that contains the result of an action.
It is a required part of the jsonAction specification standard.
Its properties vary with each action.
Property summary
"result"
property summariesProperty | Description | Type | Limits (inclusive) | |||||||
---|---|---|---|---|---|---|---|---|---|---|
signifies that the client is authenticated and authorized | string |
| ||||||||
| defines the default value of the | string enum |
| |||||||
| defines the default value for the | string |
| |||||||
| defines the default value of the | string |
| |||||||
defines the default value of the | string enum | One of the following:
| ||||||||
| specifies the initial value of the | string |
| |||||||
defines a default value for | object | One of the following:
Note
| ||||||||
| allows the client to describe an object for later identification | string |
| |||||||
| indicates an error when set to a non-zero integer or success when | integer |
| |||||||
contains the number of seconds that a session with no activity will stay open | integer |
| ||||||||
contains the number of seconds to keep a cursor open | integer |
| ||||||||
contains the account name of a user or application | string |
|
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 the client is authenticated and authorized. If the client does not supply the correct values, the server returns an unauthorized error.
"defaultDebug"
is an optional string enum that defined 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 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 "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 and omitting the error object 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": { "dataFormat": "objects", "numberFormat": "string", "binaryFormat": "hex" }
Property summary
"defaultResponseOptions"
property summariesProperty | Description | Default | Type | Limits (inclusive) | |||
---|---|---|---|---|---|---|---|
determines how binary values are returned |
| string |
| ||||
defines what format the results will be returned in |
| string |
| ||||
| controls how numbers are formatted in the JSON response message |
| string |
|
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"
.
"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.
The "idleConnectionTimeoutSeconds"
property is an optional integer from 0
to 2,147,483,647
. It is the number of seconds that a session with no activity will stay open.
Each time a session executes an operation, the session timer restarts.
A value of
0
keeps a session open indefinitely.
The "idleCursorTimeoutSeconds"
property is an optional integer from 0
to 2,147,483,647
. 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 "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.