Skip to main content

"listCodePackageHistory" (JSON Action)

Return a list of historical code packages that match all specified filters

The "listCodePackageHistory" action returns a list of code packages from the code package history that match all the specified filters.

Each returned item contains all code package properties except the "code" property. This action helps the user find previous versions of a code package. If you want to retrieve the source code, use the "describeCodePackageHistory" action.

Links: Concepts | Tutorials | FAQs

Request examples

Typical

{ 
  "api": "admin",
  "action": "listCodePackageHistory",
  "params": {    
    "databaseName": "faircom",
    "ownerName": "admin",
    "partialName": "convert",
    "codeTypeFilter": [ "getRecordsTransform", "expression" ],
    "statusFilter": [
      "developing",
      "deleted",
      "inactive",
      "deprecated",
      "testing",
      "active"
    ],
    "includeDeactivatedCode": true,
    "minCodeVersion": 5,
    "maxCodeVersion": 13,
    "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"
}
{ 
  "api": "admin",
  "action": "listCodePackageHistory",
  "params": {},
  "authToken": "replaceWithAuthTokenFromCreateSession"
}
{ 
  "api": "admin",
  "action": "listCodePackageHistory",
  "params": {
    "partialName": "convertTemperature"
  },
  "authToken": "replaceWithAuthTokenFromCreateSession"
}
{ 
  "api": "admin",
  "action": "listCodePackageHistory",
  "params": {
    "partialName": "convertTemperature",
    "minCodeVersion": 1,
    "maxCodeVersion": 2
  },
  "authToken": "replaceWithAuthTokenFromCreateSession"
}

Response

Includes all information about matching code packages except for the "code" property.

Includes the "codeId" and "codeName" properties. "codeId" is the unique numeric identifier of a code package. It is used internally by the server to reference code package records.

{
  "result": {
    "data": []
  },
  "debugInfo": {
    "request": {
      "api": "admin",
      "action": "listCodePackageHistory",
      "params": {
        "databaseName": "faircom",
        "ownerName": "admin",
        "partialName": "convert",
        "codeTypeFilter": [
          "getRecordsTransform",
          "expression"
        ],
        "statusFilter": [
          "developing",
          "deleted",
          "inactive",
          "deprecated",
          "testing",
          "active"
        ],
        "includeDeactivatedCode": true,
        "minCodeVersion": 5,
        "maxCodeVersion": 13,
        "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"
}
{
  "result": {
    "data": [
      {
        "codeId": 4,
        "databaseName": "faircom",
        "ownerName": "admin",
        "codeName": "convertTemperature",
        "codeVersion": 1,
        "clonedCodeId": 0,
        "codeStatus": "inactive",
        "codeLanguage": "javascript",
        "codeType": "getRecordsTransform",
        "description": "New description replaces old description.\nAnother description line.",
        "metadata": {
          "keyword": "temperature",
          "favorites": true
        },
        "createdBy": "ADMIN",
        "createdOn": "2024-10-15T19:29:34.216",
        "updatedBy": "ADMIN",
        "updatedOn": "2024-10-15T19:55:59.792",
        "comment": "Changed the name from convertTemperature to convertTemperature2.",
        "codeFormat": "utf8"
      },
      {
        "codeId": 3,
        "databaseName": "faircom",
        "ownerName": "admin",
        "codeName": "convertTemperature new",
        "codeVersion": 1,
        "clonedCodeId": 0,
        "codeStatus": "developing",
        "codeLanguage": "javascript",
        "codeType": "getRecordsTransform",
        "description": "1. Copies the value from the temperature property in source_payload to the temperature_celsius field.\n2. Converts temperature_celsius into Fahrenheit and stores it in the temperature_fahrenheit field.\n3. Stores alerts about temperature in temperature_status field.",
        "metadata": {},
        "createdBy": "ADMIN",
        "createdOn": "2024-10-15T19:26:35.218",
        "updatedBy": "ADMIN",
        "updatedOn": "2024-10-15T19:26:35.218",
        "comment": "optional comment about the current version",
        "codeFormat": "utf8"
      }
    ]
  },
  "debugInfo": {
    "request": {
      "api": "admin",
      "action": "listCodePackageHistory",
      "params": {},
      "debug": "max",
      "authToken": "replaceWithAuthTokenFromCreateSession"
    }
  },
  "errorCode": 0,
  "errorMessage": "",
  "authToken": "replaceWithAuthTokenFromCreateSession"
}
{
  "result": {
    "data": [
      {
        "codeId": 4,
        "databaseName": "faircom",
        "ownerName": "admin",
        "codeName": "convertTemperature",
        "codeVersion": 1,
        "clonedCodeId": 0,
        "codeStatus": "inactive",
        "codeLanguage": "javascript",
        "codeType": "getRecordsTransform",
        "description": "New description replaces old description.\nAnother description line.",
        "metadata": {
          "keyword": "temperature",
          "favorites": true
        },
        "createdBy": "ADMIN",
        "createdOn": "2024-10-15T19:29:34.216",
        "updatedBy": "ADMIN",
        "updatedOn": "2024-10-15T19:55:59.792",
        "comment": "Changed the name from convertTemperature to convertTemperature2.",
        "codeFormat": "utf8"
      },
      {
        "codeId": 3,
        "databaseName": "faircom",
        "ownerName": "admin",
        "codeName": "convertTemperature new",
        "codeVersion": 1,
        "clonedCodeId": 0,
        "codeStatus": "developing",
        "codeLanguage": "javascript",
        "codeType": "getRecordsTransform",
        "description": "1. Copies the value from the temperature property in source_payload to the temperature_celsius field.\n2. Converts temperature_celsius into Fahrenheit and stores it in the temperature_fahrenheit field.\n3. Stores alerts about temperature in temperature_status field.",
        "metadata": {},
        "createdBy": "ADMIN",
        "createdOn": "2024-10-15T19:26:35.218",
        "updatedBy": "ADMIN",
        "updatedOn": "2024-10-15T19:26:35.218",
        "comment": "optional comment about the current version",
        "codeFormat": "utf8"
      }
    ]
  },
  "debugInfo": {
    "request": {
      "api": "admin",
      "action": "listCodePackageHistory",
      "params": {
        "partialName": "convertTemperature"
      },
      "debug": "max",
      "authToken": "replaceWithAuthTokenFromCreateSession"
    }
  },
  "errorCode": 0,
  "errorMessage": "",
  "authToken": "replaceWithAuthTokenFromCreateSession"
}
{
  "result": {
    "data": [
      {
        "codeId": 4,
        "databaseName": "faircom",
        "ownerName": "admin",
        "codeName": "convertTemperature",
        "codeVersion": 1,
        "clonedCodeId": 0,
        "codeStatus": "inactive",
        "codeLanguage": "javascript",
        "codeType": "getRecordsTransform",
        "description": "New description replaces old description.\nAnother description line.",
        "metadata": {
          "keyword": "temperature",
          "favorites": true
        },
        "createdBy": "ADMIN",
        "createdOn": "2024-10-15T19:29:34.216",
        "updatedBy": "ADMIN",
        "updatedOn": "2024-10-15T19:55:59.792",
        "comment": "Changed the name from convertTemperature to convertTemperature2.",
        "codeFormat": "utf8"
      },
      {
        "codeId": 4,
        "databaseName": "faircom",
        "ownerName": "admin",
        "codeName": "convertTemperature",
        "codeVersion": 2,
        "clonedCodeId": 0,
        "codeStatus": "deleted",
        "codeLanguage": "javascript",
        "codeType": "getRecordsTransform",
        "description": "New description replaces old description.\nAnother description line.",
        "metadata": {
          "keyword": "temperature",
          "favorites": true
        },
        "createdBy": "ADMIN",
        "createdOn": "2024-10-15T19:29:34.216",
        "updatedBy": "ADMIN",
        "updatedOn": "2024-10-15T19:56:49.879",
        "comment": "Modified the code and changed the name back",
        "codeFormat": "utf8"
      },
      {
        "codeId": 3,
        "databaseName": "faircom",
        "ownerName": "admin",
        "codeName": "convertTemperature new",
        "codeVersion": 1,
        "clonedCodeId": 0,
        "codeStatus": "developing",
        "codeLanguage": "javascript",
        "codeType": "getRecordsTransform",
        "description": "1. Copies the value from the temperature property in source_payload to the temperature_celsius field.\n2. Converts temperature_celsius into Fahrenheit and stores it in the temperature_fahrenheit field.\n3. Stores alerts about temperature in temperature_status field.",
        "metadata": {},
        "createdBy": "ADMIN",
        "createdOn": "2024-10-15T19:26:35.218",
        "updatedBy": "ADMIN",
        "updatedOn": "2024-10-15T19:26:35.218",
        "comment": "optional comment about the current version",
        "codeFormat": "utf8"
      }
    ]
  },
  "debugInfo": {
    "request": {
      "api": "admin",
      "action": "listCodePackageHistory",
      "params": {
        "partialName": "convertTemperature",
        "minCodeVersion": 1,
        "maxCodeVersion": 2
      },
      "debug": "max",
      "authToken": "replaceWithAuthTokenFromCreateSession"
    }
  },
  "errorCode": 0,
  "errorMessage": "",
  "authToken": "replaceWithAuthTokenFromCreateSession"
}

The "listCodePackageHistory" action retrieves a list of historical code packages matching specified filters, excluding the "code" property. It provides request and response examples, outlining various filtering options such as by database name, owner name, partial name, code type, status, version, and comment/description/metadata filters. The document also details the "params" property with descriptions, default values, types, and limits for each filter, allowing users to precisely control their code package history queries.

API actionJSON ADMIN APIJSON ActionlistCodePackageHistorylistCodePackagesHistorylistsCodePackageHistorylistsCodePackagesHistorylist code package historycodepackagehistorical code packagelist previous versionslist previous code packageshistorical code versionsfind previous codecode package filterscode statusdeveloping codedeleted code packageinactive code packagedeprecated code packagetesting code packageactive code package
Table 1. listCodePackageHistory "params" property summaries

Property

Description

Default

Type

Limits (inclusive)

codeTypeFilter

(optional) returns code packages with a code type that matches one of the values in the array.

""

array

0 or more code types

commentFilter

(optional) returns code packages with comments that match the full-text search in "commentFilter".

null

string

1 to 65,500 bytes

databaseName

(optional) specifies the name of the database.

Defaults to the session's "defaultDatabaseName" property

string

1 to 64 bytes

descriptionFilter

(optional) returns code packages with descriptions that match the full-text search in "descriptionFilter".

null

string

1 to 65,500 bytes

includeDeactivatedCode

(optional) specifies whether or not the results include deactivated code packages.

null

Boolean

true
false

maxCodeVersion

(optional) returns code packages up to an including the specified version.

Current version

integer

1 to 2147483647

maxRecords

(optional) specifies the maximum number of results to return.

20

integer

-1 to 65535

metadataFilter

(optional) returns code packages with metadata that match the full-text search in the "metadataFilter".

null

string

1 to 65,500 bytes

minCodeVersion

(optional) returns code packages starting on or after the specified version.

First version

integer

1 to 2147483647

ownerName

(optional) specifies the name of the owner.

Defaults to the session's "defaultOwnerName" property

string

1 to 64 bytes

partialName

(optional) returns code packages with names that match its value.

""

string

1 to 64 bytes

skipRecords

(optional) specifies the number of results to skip.

0

integer

0 to 9223372036854775807

statusFilter

(optional) returns code packages with statuses that match one of the values in the array.

[]

array

"developing"
"deleted"
"inactive"
"deprecated"
"testing"
"active"


"codeTypeFilter" is an optional query filter with an array of code types. 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.

"commentFilter" is an optional query filter that is a string value. 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. See Full-text filter expressions.

The "databaseName" property is an optional string from 1 to 64 bytes that 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.

"descriptionFilter" is an optional string value that defaults to null. 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. See Full-text filter expressions.

"includeDeactivatedCode" is an optional query filter that is a Boolean value. It defaults to null. 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.

"maxCodeVersion" is an optional integer and defaults to the current version of the code package. If specified, the server returns code packages up to and including the specified version.

"maxRecords" is an optional string value that defaults to 20. 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".

"metadataFilter" is an optional string value that defaults to null. 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. See Full-text filter expressions. A code package's "metadata" property contains a JSON object with user-defined key-value pairs.

"minCodeVersion" is an optional integer that defaults to the code package's first version. If specified, the server returns code packages starting with the specified version.

The "ownerName" property is an optional string from 1 to 64 bytes that specifies the account that owns an object, such as a table or code package. If it is set to null or is omitted, it defaults to the account that created the JSON Action session, see "createSession" and the "defaultOwnerName" property. 

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.

"partialName" is an optional query filter that 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.

"skipRecords" is an optional string value that defaults to 0. 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".

"statusFilter" is an optional query filter consisting of an array of status values. 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.

Table 2. listCodePackages "result" property summaries

Property

Description

Type

Contents

clonedCodeId

indicates the cloned code ID.

integer

The cloned code ID.

codeVersion

indicates the version of the code package.

integer

The version of the specified code package.

createdBy

indicates the name of the account used to create the code package.

string

The name of the account used to create the code package.

createdOn

indicates the date and time the code package was created.

timestamp

The date and time when the code package was created.

data

lists each code package with its associated properties and values.

array of objects

An object for each code package.

updatedBy

indicates the name of the last account used to update the code package.

string

The name of the account last used to update the code package.

updatedOn

indicates the date and time the code package was last updated.

timestamp

The date and time the code package was last updated.



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
    ]
  },

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
    ]
  },

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"
      },
    ]

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"
      },
    ]

The "data" property lists each code package in separate objects. Each object contains the associated properties and values for the specified code package.

  "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"
      },
    ]

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"
      },
    ]

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"
      },
    ]