listCodePackages

Return a list of code packages that match all specified filters

Each returned item in the list contains all code package properties except the "code" property. This action helps the user find the current code package. If you want to retrieve the source code, use the "describeCodePackages" action.

 

Request examples

Typical

{ 
  "api": "admin",
  "action": "listCodePackages",
  "params": {
    "databaseName": "faircom",
    "ownerName": "admin",
    "partialName": "convert",

    "codeTypeFilter": [ "getRecordsTransform", "expression" ],
    "statusFilter": [
      "developing",
      "deleted",
      "inactive",
      "deprecated",
      "testing",
      "active"
    ],
    "includeDeactivatedCode": true,

    "commentFilter": "words, phrases, NEAR, full-text search",
    "descriptionFilter": "words, phrases, NEAR, full-text search",
    "metadataFilter": "words, phrases, NEAR, full-text search",

    "skipRecords": 100,
    "maxRecords": 25
  },
  "authToken": "replaceWithAuthTokenFromCreateSession"
}
 
 

list all code packages

{ 
  "api": "admin",
  "action": "listCodePackages",
  "params": {},
  "authToken": "replaceWithAuthTokenFromCreateSession"
}
 
 

list some code packages

{ 
  "api": "admin",
  "action": "listCodePackages",
  "params": {
    "codeTypeFilter": ["getRecordsTransform"],
    "statusFilter": ["developing"],
    "includeDeactivatedCode": true
  },
  "authToken": "replaceWithAuthTokenFromCreateSession"
}
 
 

 

Response examples

Typical

{
  "result": {
    "data": []
  },
  "debugInfo": {
    "request": {
      "api": "admin",
      "action": "listCodePackages",
      "params": {
        "databaseName": "faircom",
        "ownerName": "admin",
        "partialName": "convert",
        "codeTypeFilter": [
          "getRecordsTransform",
          "expression"
        ],
        "statusFilter": [
          "developing",
          "deleted", 
          "inactive",
          "deprecated",
          "testing",
          "active"
        ],
        "includeDeactivatedCode": true,
        "commentFilter": "words, phrases, NEAR, full-text search",
        "descriptionFilter": "words, phrases, NEAR, full-text search",
        "metadataFilter": "words, phrases, NEAR, full-text search",
        "skipRecords": 100,
        "maxRecords": 25
      },
      "debug": "max",
      "authToken": "replaceWithAuthTokenFromCreateSession"
    }
  },
  "errorCode": 0,
  "errorMessage": "",
  "authToken": "replaceWithAuthTokenFromCreateSession"
}
 
 

List all code packages

{
  "result": {
    "data": [
      {
        "codeId": 6,
        "databaseName": "faircom",
        "ownerName": "admin",
        "codeName": "convertAndCategorizeTemperature",
        "codeVersion": 1,
        "clonedCodeId": 4,
        "codeStatus": "deleted",
        "codeLanguage": "javascript",
        "codeType": "getRecordsTransform",
        "description": "",
        "metadata": {
          "keyword": "temperature",
          "favorites": true
        },
        "createdBy": "ADMIN",
        "createdOn": "2024-10-15T19:58:42.471",
        "updatedBy": "ADMIN",
        "updatedOn": "2024-10-15T19:58:42.471",
        "comment": "",
        "codeFormat": "utf8"
      },
      {
        "codeId": 4,
        "databaseName": "faircom",
        "ownerName": "admin",
        "codeName": "convertTemperature",
        "codeVersion": 2,
        "clonedCodeId": 0,
        "codeStatus": "deleted",
        "codeLanguage": "javascript",
        "codeType": "getRecordsTransform",
        "description": "",
        "metadata": {
          "keyword": "temperature",
          "favorites": true
        },
        "createdBy": "ADMIN",
        "createdOn": "2024-10-15T19:29:34.216",
        "updatedBy": "ADMIN",
        "updatedOn": "2024-10-15T19:56:49.879",
        "comment": "",
        "codeFormat": "utf8"
      },
      {
        "codeId": 5,
        "databaseName": "faircom",
        "ownerName": "admin",
        "codeName": "convertTemperature V2",
        "codeVersion": 1,
        "clonedCodeId": 4,
        "codeStatus": "developing",
        "codeLanguage": "javascript",
        "codeType": "getRecordsTransform",
        "description": "",
        "metadata": {},
        "createdBy": "ADMIN",
        "createdOn": "2024-10-15T19:58:19.699",
        "updatedBy": "ADMIN",
        "updatedOn": "2024-10-15T19:58:19.699",
        "comment": "",
        "codeFormat": "utf8"
      },
      {
        "codeId": 3,
        "databaseName": "faircom",
        "ownerName": "admin",
        "codeName": "convertTemperature new",
        "codeVersion": 2,
        "clonedCodeId": 0,
        "codeStatus": "active",
        "codeLanguage": "javascript",
        "codeType": "getRecordsTransform",
        "description": "optional new description",
        "metadata": {},
        "createdBy": "ADMIN",
        "createdOn": "2024-10-15T19:26:35.218",
        "updatedBy": "ADMIN",
        "updatedOn": "2024-10-15T19:27:28.192",
        "comment": "optional change comment",
        "codeFormat": "utf8"
      }
    ]
  },
  "debugInfo": {
    "request": {
      "api": "admin",
      "action": "listCodePackages",
      "params": {},
      "debug": "max",
      "authToken": "replaceWithAuthTokenFromCreateSession"
    }
  },
  "errorCode": 0,
  "errorMessage": "",
  "authToken": "replaceWithAuthTokenFromCreateSession"
}
 
 

List some code packages

{
  "result": {
    "data": [
      {
        "codeId": 5,
        "databaseName": "faircom",
        "ownerName": "admin",
        "codeName": "convertTemperature V2",
        "codeVersion": 1,
        "clonedCodeId": 4,
        "codeStatus": "developing",
        "codeLanguage": "javascript",
        "codeType": "getRecordsTransform",
        "description": "optional new description",
        "metadata": {},
        "createdBy": "ADMIN",
        "createdOn": "2024-10-15T19:58:19.699",
        "updatedBy": "ADMIN",
        "updatedOn": "2024-10-15T19:58:19.699",
        "comment": "optional change comment",
        "codeFormat": "utf8"
      }
    ]
  },
  "debugInfo": {
    "request": {
      "api": "admin",
      "action": "listCodePackages",
      "params": {
        "codeTypeFilter": [
          "getRecordsTransform"
        ],
        "statusFilter": [
          "developing"
        ],
        "includeDeactivatedCode": true
      },
      "debug": "max",
      "authToken": "replaceWithAuthTokenFromCreateSession"
    }
  },
  "errorCode": 0,
  "errorMessage": "",
  "authToken": "replaceWithAuthTokenFromCreateSession"
}
 
 

 

Properties

Request properties ("params")

Property Description Default Type Limits (inclusive)

codeTypeFilter

The "codeTypeFilter" property filters results by the value in the "codeType" property. If the array is empty, null, or omitted, it matches all code types; otherwise, it returns code packages with a code type that matches one of the array's values. Optional with default of "" array

"integrationTableTransform"

"expression"

"getRecordsTransform"

"globalFunction"

"module"

"event"

"beforeTrigger"

"afterTrigger"

"job"

commentFilter

The "commentFilter" property filters the results by the value of the "comment" property. It defaults to null. If this value is not null or omitted, the results only include code packages with comments that match the full-text search specified in the "commentFilter" property. For example, to constrain results to include the three words FairCom Edge rocks anywhere in a comment, use "commentFilter": "FairCom Edge rocks". Optional with default of null string 1 to 65,500 bytes

databaseName

The "databaseName" property specifies the database that contains an object, such as a table or code package. If it is set to null or is omitted, it defaults to the default database of the JSON Action session, see "createSession" and the "defaultDatabaseName" property. 

You specify this property when you want to use a different database instead of the default. Your session's account must have the appropriate privileges to access the code package.

This property is useful because objects, such as tables and code packages, can have the same name in multiple databases. This feature allows you to create multiple environments in the same server and reuse the same JSON actions in each environment. For example, you can create "dev", "test", "stage", and "prod" databases on the same server and use the "defaultDatabaseName" or "databaseName" properties to specify the desired environment.

It is an error to set "databaseName" to the empty string "".

If no default database is specified during "createSession", the server sets the "defaultDatabaseName" to the "defaultDatabaseName" value specified in the services.json file.

Defaults to the session's "defaultDatabaseName" property string 1 to 64 bytes

descriptionFilter

The 

"descriptionFilter" property filters the response by the value of the "description" property. If the value is not null or omitted, the results only include code packages with descriptions that match the full-text search specified in the "descriptionFilter" property. For example, to constrain results to include the exact phrase 'FairCom Edge rocks' and the phrase 'around the clock' in the description, use "descriptionFilter": "'FairCom Edge rocks' 'around the clock'". Notice that a phrase is enclosed in single quotation marks. To constrain results to include the word FairCom as the first word plus the word rocks anywhere else in the description, use the search string, "descriptionFilter": "^FairCom rocks". The ^ operator followed by a word or phrase can only be included once in a full-text expression.

 

Optional with default of null string 1 to 65,500 bytes

includeDeactivatedCode

The "includeDeactivatedCode" property specifies whether to include deactivated code packages in the response. The results include activated and deactivated code packages if this value is null or omitted. If set to true, the results only include deactivated code packages. If set to false, the results only include activated code packages.

 

Optional with default of null Boolean

true

false

maxRecords

The "maxRecords" property specifies the maximum number of records to be returned. It is used with "skipRecords" to paginate the results. If the value is not null or omitted, the server returns the maximum number of results specified by "maxRecords". Optional with default of 20  integer -1 to 65535

metadataFilter

The "metadataFilter" property filters results by the value of the "metadata" property. If the value is not null or omitted, the results only include code packages with metadata that match the full-text search specified in the "metadataFilter" property. A code package's "metadata" property contains a JSON object with user-defined key-value pairs. For example, to constrain results to include the key value pair "myProperty": "myValue" in the metadata, use the search string, "metadataFilter": "'myProperty' NEAR/0 'myValue'". Notice that NEAR/0 specifies no intervening words or phrases. If you want to allow a maximum of one intervening word, use NEAR/1. You can specify a maximum of any number of intervening words.  Optional with default of null string 1 to 65,500 bytes

ownerName

The "ownerName" property specifies the account that owns an object, such as a table or code package. See "createSession" and the "defaultOwnerName" property for more details. 

You specify this property when you want to use a different account instead of the default. Your session's account must have the appropriate privileges to access the code package. 

This property is useful because objects, such as tables and code packages, can have the same name in the same database as long as different accounts own each object. This feature allows you to create duplicate objects for different users on the same server and reuse the same JSON actions on those objects. For example, an administrator can copy objects from a production environment to her account so she can troubleshoot an issue using the same JSON actions, JavaScript, and SQL code.

It is an error to set "ownerName" to the empty string "".

If no default owner is specified during "createSession", the server sets the "defaultOwnerName" to the "defaultOwnerName" value specified in the services.json file.

Optional with default of the session's "defaultOwnerName" property string 1 to 64 bytes

partialName

The "partialName" property returns code packages with code names that match the value of "partialName". The match starts at the name's beginning, making it a "starts with" match instead of a "substring" match. If the partial name is empty, null, or omitted, it matches all names.

Optional with default of "" string 1 to 64 bytes

skipRecords

The "skipRecords" property specifies the number of records to skip over when paginating the results. It is used with "maxRecords" to paginate the results. If the value is not null or omitted, the server returns results from the beginning. If it is > 0, the server skips over the specified number of records and returns results starting from that point up until it returns the maximum number of results as defined by "maxRecords". Optional with default of 0 integer 0 to 9223372036854775807

statusFilter

The "statusFilter" property filters results based on the value of the "status" property. If the array is empty, null, or omitted, it matches all status values; otherwise, it returns code packages only when their status matches one of the values in the array. If "includeDeactivatedCode" is set to true or false, it overrides conflicting status codes.

 

When using the tag actions, this property finds tags based on their status. You can include zero or more status values. The "listTags" action returns tags that match at least one of the specified status values. An empty array or null value matches all status values.

  • Use "statusFilter": "active" to return active tags.
  • Use "statusFilter": "inactive" to return inactive tags.
  • The "listTags" action returns tags that match at least one of the specified status values.
  • Omitting the property or setting it to null matches all tags.
Optional with default of [] array

"developing"

"deleted"

"inactive"

"deprecated"

"testing"

"active"

 

When using tag actions, "inactive" and "active" are the only valid statuses 

 

Response properties ("result")

Property Description Type Limits (inclusive)

data

The "data" property contains a response message. Its contents are defined by the action. It is an empty array when no results are available. The following is an example of the data property from a code package action.

  "result": {
    "data": [
      {
        "codeId": 6,
        "databaseName": "faircom",
        "ownerName": "admin",
        "codeName": "convertAndCategorizeTemperature",
        "codeVersion": 1,
        "clonedCodeId": 1,
        "codeStatus": "active",
        "codeLanguage": "javascript",
        "serviceName": "javascript",
        "codeType": "module",
        "description": "optional new description",
        "metadata": {},
        "createdBy": "ADMIN",
        "createdOn": "2025-08-25T21:48:38.109",
        "updatedBy": "ADMIN",
        "updatedOn": "2025-08-25T21:48:38.109",
        "comment": "Cloned from convertTemperature",
        "codeFormat": "utf8"
      },
    ]
array of objects The action determines its contents.

data

.clonedCodeId

The "clonedCodeId" indicates which copy the specified code package is out of all existing code package clones. If the specified code package is the original one, its value will be 0.

  "result": {
    "data": [
      {
        "codeId": 1,
        "databaseName": "faircom",
        "ownerName": "admin",
        "codeName": "convertTemperature",
        "codeVersion": 1,
        "clonedCodeId": 0
    ]
  },
integer The cloned code ID.

data

.codeFormat

The "codeFormat" property specifies the encoding of code in the code property. You must encode your code to embed it in a JSON string. "codeFormat" currently only supports the "utf8" encoding, requiring you to use JSON rules to escape problem characters in your code with the \ backslash character, such as \n. string "utf8"

data

.codeId

The "codeId" property specifies the unique numeric identifier of a code package. integer No limit

data

.codeLanguage

The "codeLanguage" property specifies the programming language of the code contained in the "code" property . Any string value is accepted. Currently, "javascript" and "json" are the only types of code the FairCom server can use. string

"javascript"

"json"

data

.codeName

The "codeName" property contains the user-defined name for the code package.

It is an error to set "codeName" to the empty string "".

The package's unique identifier is the combination of "databaseName", "ownerName", and "codeName". See the "databaseName" and "ownerName" properties for more information.

string 1 to 64 bytes

data

.codeStatus

The "codeStatus" property specifies a new status for the code. When you create a code package, it defaults to "developing". When you alter a code package, it defaults to the current state. You may set it to one of the following states: "developing", "deleted", "inactive", "deprecated", "testing", or "active". You can use "alterCodePackage" to transition from any state to any other. See "Use "codeStatus" to make a package runnable". string

"developing"

"deleted"

"inactive"

"deprecated"

"testing"

"active"

data

.codeType

The "codeType" property defines how and where a FairCom server can run the JavaScript code. See Code Package Types for how to use each type of Code Package. The following enumerated values are supported:

string

"integrationTableTransform"

"getRecordsTransform"

data

.codeVersion

The "codeVersion" property indicates the version of the specified code package.

  "result": {
    "data": [
      {
        "codeId": 1,
        "databaseName": "faircom",
        "ownerName": "admin",
        "codeName": "convertTemperature",
        "codeVersion": 1,
        "clonedCodeId": 0
    ]
  },
integer The version of the specified code package.

data

.comment

The "comment" property explains the code change. string 1 to 65,535 bytes

data

.createdBy

The "createdBy" property indicates the name of the account used to create the specified code package.

  "result": {
    "data": [
      {
        "createdBy": "ADMIN",
        "createdOn": "2025-08-25T21:48:38.109",
        "updatedBy": "ADMIN",
        "updatedOn": "2025-08-25T21:48:38.109"
      },
    ]
string The name of the account used to create the code package.

data

.createdOn

The "createdOn" property indicates the date and time the code package was created.

  "result": {
    "data": [
      {
        "createdBy": "ADMIN",
        "createdOn": "2025-08-25T21:48:38.109",
        "updatedBy": "ADMIN",
        "updatedOn": "2025-08-25T21:48:38.109"
      },
    ]
timestamp The date and time when the code package was created.

data

.databaseName

The "databaseName" property specifies the database that contains the tables. 

Note In the API Explorer, "defaultDatabaseName" is set to "ctreeSQL" in the "createSession" action that happens at login.

  • 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", "databaseName" will be set to the "defaultDatabaseName" value that is specified in the services.json file.
  • This property's value is case insensitive. 
string 1 to 64 bytes

data

.description

The "description" property provides additional information about an object, such as a label or thing. You can use it as internal or external documentation of a label's meaning, purpose, and usage.

Markdown is a good language for formatting description text. You must ensure the text is compatible with a JSON string. For example, you must escape a double quote character using the backslash character:  \".

 

In the Thing API, It defaults to "unknown" and is a string from 1 to 512 bytes. You cannot use it for lookups and filtering.

 

string 1 to 65,500 bytes

data

.metadata

The "metadata" field allows a customer to add a JSON value to an object such as a label or thing. It is typically a JSON object, but may be any JSON value. Its purpose is to provide additional metadata about the label, such as translations in multiple languages, historical value changes, etc. The "alterLabel" action can only replace this value with a new JSON value.

JSON 0 to 65,500 bytes

data

.ownerName

The "ownerName" property identifies the user who owns an object (see Object owner).  string 0 to 64 bytes

data

.updatedBy

The "updatedBy" property indicates the name of the account last used to update the code package.

  "result": {
    "data": [
      {
        "createdBy": "ADMIN",
        "createdOn": "2025-08-25T21:48:38.109",
        "updatedBy": "ADMIN",
        "updatedOn": "2025-08-25T21:48:38.109"
      },
    ]
string The name of the account last used to update the code package.

data

.updatedOn

The "updatedOn" property indicates the date and time the code package was last updated.

  "result": {
    "data": [
      {
        "createdBy": "ADMIN",
        "createdOn": "2025-08-25T21:48:38.109",
        "updatedBy": "ADMIN",
        "updatedOn": "2025-08-25T21:48:38.109"
      },
    ]
timestamp The date and time the code package was last updated.