"listServices" (JSON Action)
Return information about the specified services
Note
The "listServices" action both lists and describes each service.
When a valid
"authToken"property is present, this action returns all information about each service.When an
"authToken"is omitted, this action returns all information except for the"tls"property.
Links: Concepts | Tutorials | FAQs
Request examples
Retrieve service information that does not require authorization
{
"api": "admin",
"action": "listServices",
"params": {}
}Retrieve extensive service information
{
"api": "admin",
"action": "listServices",
"params": {},
"authToken": "replaceWithAuthTokenFromCreateSession"
}{
"api": "admin",
"action": "listServices",
"params": {},
"requestId": "2",
"apiVersion": "1.0",
"debug": "max",
"authToken": "replaceWithAuthTokenFromCreateSession"
}
Note
FairCom Edge has more services than FairCom DB and the "jsonActionApiDefaults" property has different default settings.
{
"result": {
"listeners": [
{
"serviceName": "http8080",
"description": "Port 8080 using insecure HTTP protocol for REST and Web Apps on all TCP/IP addresses bound to this server",
"enabled": false,
"port": "8080",
"protocol": "http"
},
{
"serviceName": "https8443",
"description": "Port 8443 using TLS-secured HTTPS protocol for REST and Web Apps on all TCP/IP addresses bound to this server",
"enabled": true,
"port": "8443",
"protocol": "https",
"tls": {
"certificateFilename": "./web/fccert.pem"
}
},
{
"serviceName": "mqtt1883",
"description": "Port 1883 using insecure MQTT protocol for the MQTT broker on all TCP/IP addresses bound to this server",
"enabled": true,
"port": "1883",
"protocol": "mqtt"
},
{
"serviceName": "mqtts8883",
"description": "Port 8883 using TLS-secured MQTTS protocol for the MQTT broker on all TCP/IP addresses bound to this server",
"enabled": true,
"port": "8883",
"protocol": "mqtts",
"tls": {
"certificateFilename": "./web/fccert.pem"
}
},
{
"serviceName": "mqttws9001",
"description": "Port 9001 using WebSocket protocol for the MQTT broker on all TCP/IP addresses bound to this server",
"enabled": true,
"port": "9001",
"protocol": "mqttws"
},
{
"serviceName": "mqttwss9002",
"description": "Port 9002 using TLS-secured WebSocket protocol for the MQTT broker on all TCP/IP addresses bound to this server",
"enabled": true,
"port": "9002",
"protocol": "mqttwss",
"tls": {
"certificateFilename": "./web/fccert.pem"
}
},
{
"serviceName": "ISAM",
"enabled": false,
"port": "FAIRCOMS",
"protocol": "isam"
},
{
"serviceName": "SQL",
"enabled": false,
"port": "6597",
"protocol": "sql"
}
],
"jsonActionApiDefaults": {
"defaultApi": "hub",
"defaultBinaryFormat": "hex",
"defaultDatabaseName": "faircom",
"defaultDebug": "max",
"defaultOwnerName": "admin",
"defaultResponseOptions": {
"binaryFormat": "hex",
"dataFormat": "objects",
"numberFormat": "number",
"variantFormat": "json"
},
"idleConnectionTimeoutSeconds": 3600,
"idleCursorTimeoutSeconds": 600
},
"applicationRoot": "./web/apps/",
"applications": [
{
"serviceName": "Ace Monitor",
"serviceLibrary": "ctmonitor.dll",
"enabled": true,
"uriPath": "AceMonitor"
},
{
"serviceName": "Data Explorer",
"serviceLibrary": "ctsqlexplorer.dll",
"enabled": true,
"uriPath": "SQLExplorer"
},
{
"serviceName": "ISAM Explorer",
"serviceLibrary": "ctisamexplorer.dll",
"enabled": true,
"uriPath": "ISAMExplorer"
},
{
"serviceName": "Rest CRUD",
"serviceLibrary": "ctrest.dll",
"enabled": true,
"uriPath": "ctree"
},
{
"serviceName": "api",
"enabled": true,
"uriPath": "api"
}
],
"apis": [
{
"serviceName": "hub",
"enabled": true
},
{
"serviceName": "mq",
"enabled": true
},
{
"serviceName": "db",
"enabled": true
}
],
"integrationServices": [
{
"serviceName": "opcua",
"serviceLibrary": "opcservice.dll",
"enabled": true
},
{
"serviceName": "modbus",
"serviceLibrary": "modbusservice.dll",
"enabled": true
}
],
"transformServices": [
{
"serviceName": "siemensUDT2JSON",
"serviceLibrary": "siemensudtservice.dll",
"enabled": false
}
],
"otherServices": [
{
"serviceName": "dbnotify",
"serviceLibrary": "./dbnotify/fcdbnotify.dll",
"enabled": false
},
{
"serviceName": "ctagent",
"serviceLibrary": "./agent/ctagent.dll",
"enabled": false
},
{
"serviceName": "thingworx",
"serviceLibrary": "./thingworx/ctthingworx.dll",
"enabled": false
},
{
"serviceName": "aggregation",
"serviceLibrary": "./aggregation/cttimestamp.dll",
"enabled": false
},
{
"serviceName": "cthttpd",
"serviceLibrary": "./web/cthttpd.dll",
"enabled": true
}
]
},
"requestId": "00000006",
"errorCode": 0,
"errorMessage": "",
"authToken": "replaceWithAuthTokenFromCreateSession"
}
{
"authToken": "invalidAuthtoken",
"debugInfo": {
"request": {
"authToken": "invalidAuthtoken",
"api": "admin",
"action": "listServices",
"params": {}
}
},
"errorCode": 12031,
"errorMessage": "'authToken' does not match any existing session. Use a valid 'authToken' or use 'createSession' to create a valid 'authToken'."
}
The "listServices" action returns information about the specified services, including a detailed description of each service. When a valid "authToken" is present, it returns all information. If the "authToken" is omitted, it returns all information except for the "tls" property.
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.
"params" property summariesProperty | Description | Default | Type | Limits (inclusive) | |||
|---|---|---|---|---|---|---|---|
(optional) contains one or more authorization token strings. |
| array | At least one | ||||
(optional) specifies what format the results will be returned in. |
| string enum |
| ||||
(optional) specifies the maximum number of results to return. |
| integer |
| ||||
(optional) specifies the number of results to skip. |
| integer |
|
The "authTokens" property is an array that specifies which sessions the server should return in its response. At least one valid "authToken" must be specified in this property.
{
"api": "admin",
"requestId": "2",
"action": "replaceWithCorrectAction",
"params": {
"authTokens": [
"replaceWithAuthTokenFromCreateSession",
"replaceWithAuthTokenFromCreateSession"
]
},
"authToken": "replaceWithAuthTokenFromCreateSession"
}
The "maxRecords" is an optional integer from -1 to 65535 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"istrue.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
0for"maxRecords"is not useful because it causes the action to return no records."maxRecords"is ignored by the"getRecordsByIds"action.
The "skipRecords" property is an optional integer from 0 to 9223372036854775807. 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"istrue.Note
This does not apply to the actions where
"returnCursor"is not present.
The "result" property is a required object set by the server that contains the result of an action.
"result" property summariesProperty | Description | Type | Contents | ||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
specifies and controls FairCom's jsonAction APIs. | array of objects | One object for each API. | |||||||||||||||||
| details if the service is enabled. | Boolean |
| ||||||||||||||||
| specifies the name of a service that collects data from an external source and inserts it into an integration table. | string | A service name between 1 and 64 bytes. | ||||||||||||||||
specifies the base folder where FairCom's web applications are located. | string | The filepath to the folder where FairCom's apps are located. | |||||||||||||||||
specifies and controls FairCom's app servers. | array of objects | One object per application. | |||||||||||||||||
| enables or disables the service. | Boolean |
| ||||||||||||||||
| specifies the filename of the app server's dynamic link library. | string | The file name for the service library. | ||||||||||||||||
| specifies the name of a service that collects data from an external source and inserts it into an integration table. | string | A service name between 1 and 64 bytes. | ||||||||||||||||
| specifies the endpoint where the app server listens for the requests. | string | The file path for the service library. | ||||||||||||||||
jsonActionApiDefaults | object |
| |||||||||||||||||
| specifies the default value of the | string |
| ||||||||||||||||
| specifies the default value for the | string enum |
| ||||||||||||||||
| specifies the variant format the server uses when the user omits the | string enum |
| ||||||||||||||||
| (optional) specifies the default value of the | string | 1 to 64 bytes | ||||||||||||||||
| specifies the default value of the | string enum |
| ||||||||||||||||
| (optional) specifies the initial value of the | string | 1 to 64 bytes | ||||||||||||||||
| specifies a default value for | object |
| ||||||||||||||||
| specifies how binary values are returned. | string enum |
| ||||||||||||||||
| specifies what format the results will be returned in. | string enum |
| ||||||||||||||||
| specifies how numbers are formatted in the JSON response message. | string enum |
| ||||||||||||||||
| specifies how the server will represent the values of variant fields in its response to your request. | string enum |
| ||||||||||||||||
| specifies how many retention units will be retained if the | integer |
| ||||||||||||||||
| specifies the default way in which messages are persisted if the | string enum |
| ||||||||||||||||
| specifies the default unit of time after which the expired messages will be purged if the | string enum |
| ||||||||||||||||
| integer | ||||||||||||||||||
| integer | ||||||||||||||||||
| integer | ||||||||||||||||||
| Boolean |
| |||||||||||||||||
| specifies the number of seconds that a session with no activity will stay open. | integer |
| ||||||||||||||||
| specifies the number of seconds to keep a cursor open. | integer |
| ||||||||||||||||
specifies and controls FairCom's integration services. | array of objects | ||||||||||||||||||
| details if the service is enabled. | Boolean |
| ||||||||||||||||
| string | ||||||||||||||||||
| specifies the filename of the app server's dynamic link library. | string | |||||||||||||||||
| specifies the name of a service that collects data from an external source and inserts it into an integration table. | string | |||||||||||||||||
specifies and controls FairCom's listeners. | array of objects | ||||||||||||||||||
| enables or disables the service. | Boolean |
| ||||||||||||||||
| describes an object for later identification. | string | 0 to 65,500 bytes | ||||||||||||||||
| specifies the port number. | integer | |||||||||||||||||
| specifies the name of a protocol. | string | |||||||||||||||||
| specifies the filename of the app server's dynamic link library. | string | |||||||||||||||||
| specifies the name of a service that collects data from an external source and inserts it into an integration table. | string | |||||||||||||||||
| specifies optional properties for using TLS to create secure communications. |
| object | ||||||||||||||||
| specifies an array of ciphers that the server will accept for communications with clients. | string | |||||||||||||||||
| specifies the name and optional path of the certificate authorities certificate file (such as | string | |||||||||||||||||
| specifies the name and optional path of a server certificate file (such as | string | |||||||||||||||||
| specifies the name and optional path of a server key file (such as | string | |||||||||||||||||
requestIterationMilliseconds | integer | ||||||||||||||||||
requestMaxThreads | integer | ||||||||||||||||||
maxConnectionsPerIpAddress | integer | ||||||||||||||||||
transformServices | array of objects | ||||||||||||||||||
| Boolean |
| |||||||||||||||||
| string | ||||||||||||||||||
| specifies the name of a service that collects data from an external source and inserts it into an integration table. | string | |||||||||||||||||
codeServices | array of objects | ||||||||||||||||||
| Boolean |
| |||||||||||||||||
| string | ||||||||||||||||||
| specifies the name of a service that collects data from an external source and inserts it into an integration table. | string |
The "apis" property is an array of objects that describes and controls FairCom's jsonAction APIs. It defaults to an empty object.
Each API is a service provided by the FairCom server.
Do not change the settings of the object properties unless you disable an unused API.
The "applicationRoot" property is a string that specifies the location of web applications relative to <faircom>/server/ .
The default value of "./web/apps/" translates to the folder <faircom>/server/web/apps.
There is rarely a reason to change the "applicationRoot".
For information on how to add your own web applications, which can use any of FairCom's jsonAction APIs, contact FairCom.
The "applications" property is an array of objects that describes and controls web applications that can run with the FairCom server. It defaults to an empty array which means no applications are configured to run.
FairCom and other custom web applications are single-page, browser-based applications served from folders in the default <faircom>/server/web/apps/ folder.
An app server is a backend service used by one or more web applications. It listens to HTTP and/or WebSocket requests and then returns results.
Contact FairCom for information on how to build and add your own app servers using C or C++.
The following "applications" properties should be considered for each web app:
"enabled""serviceName"
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 tonull, 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 sessionWhen
"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 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.
"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.000144722494are 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
nullThis 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 "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
-1keeps a cursor open indefinitely.A value of
0immediately closes a cursor after the current operation.
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 sessionWhen
"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 "integrationServices" property is an array of objects that describes and controls FairCom's integration services. It defaults to an empty array.
An integration service is a connector that uses a protocol to collect information from devices and/or deliver information to devices — for example, FairCom Edge includes connectors that collect data from Modbus and OPC UA.
For information on how to build and add your own connectors using C or C++, contact FairCom.
Do not change the settings of the object properties unless disabling an unused connector.
The "listeners" property is an array of objects that describes and controls FairCom's listeners. It defaults to an empty array.
A listener is a service that listens on a specified TCP/IP port for a specified protocol.
FairCom servers provide listeners for the protocols:
"http""https""mqtt""mqtts""mqttws""mqttwss"
Each protocol is hardwired to a specific set of backend services:
The
HTTPandHTTPSprotocols are hardwired to support the jsonAction APIs and web applications.The MQTT and MQTTS protocols are hardwired to support MQTT protocols 3.1.1 and 5.0 over TCP/IP.
The MQTTWS and MQTTWSS protocols are hardwired to support MQTT protocols 3.1.1 and 5.0 over WebSocket.
For information on how to build and add your own listeners using C or C++, contact FairCom.
Do not change the object property settings unless disabling an unused listener.
Each protocol can listen with TLS authentication for secure communications.
The "tls" property is a JSON object that defines the public server certificate filename, the private key filename, the certificate authority filename, the cipher suites that are allowed, and whether the client certificate is required. This property is optional. It defaults to an empty object.
Example
"tls": { "serverCertificateFilename": "server.crt", "privateKeyFilename": "server.key", "caCertificateFilename": "ca.crt", "allowedCipherSuites": "AES256-SHA256" "requireClientCertificate": "true"
} "tls": {
"enabled": true,
"caCertificateFilename": "ca.crt",
"allowedCipherSuites": "",
"clientCertificateEnabled": true,
"clientCertificateFilename": "admin_client.crt",
"clientPrivateKeyFilename": "admin_client.key"
}The "otherServices" property is an optional array of objects that describes and controls FairCom's other services. It defaults to the services connected when the server last started up.
"otherServices": [
{
"serviceName": "dbnotify",
"serviceLibrary": "./dbnotify/fcdbnotify.dll",
"enabled": false
}
],The "transformServices" property is an optional array of objects that describes and controls FairCom's transform services. It defaults to the services connected when the server last started up.
"transformServices" [
{
"serviceName": "siemensUDT2JSON",
"serviceLibrary": "siemensudtservice.dll",
"enabled": true
}
],