Skip to main content

"describeCodePackageHistory" (JSON Action)

Return historical information about the specified code packages

The "describeCodePackageHistory" action returns historical versions of the code package, including code and metadata.

You can use the optional "minCodeVersion" and "maxCodeVersion" properties to limit the versions returned.

You can use the optional "skipRecords" and "maxRecords" properties to paginate the results.

Links: Concepts | Tutorials | FAQs

Request example

{ 
  "api": "admin",
  "action": "describeCodePackageHistory",
  "params": {
    "databaseName": "faircom",
    "ownerName": "admin",
    "codeName": "convertTemperature",
    "codeFormat": "utf8",
    "minCodeVersion": 5,
    "maxCodeVersion": 13,
    "skipRecords": 100,
    "maxRecords": 25
  },
  "authToken": "replaceWithAuthTokenFromCreateSession"
}
{
  "result": {
    "data": []
  },
  "debugInfo": {
    "request": {
      "api": "admin",
      "action": "describeCodePackageHistory",
      "params": {
        "databaseName": "faircom",
        "ownerName": "admin",
        "codeName": "convertTemperature",
        "codeFormat": "utf8",
        "minCodeVersion": 5,
        "maxCodeVersion": 13,
        "skipRecords": 100,
        "maxRecords": 25
      },
      "debug": "max",
      "authToken": "replaceWithAuthTokenFromCreateSession"
    }
  },
  "errorCode": 0,
  "errorMessage": "",
  "authToken": "replaceWithAuthTokenFromCreateSession"
}

The "describeCodePackageHistory" action retrieves historical versions of code packages, including code and metadata. Optional parameters like "minCodeVersion," "maxCodeVersion," "skipRecords," and "maxRecords" allow for version filtering and result pagination. The request requires "codeName" and accepts optional "databaseName" and "ownerName." "codeFormat" defaults to "utf8." Response data is paginated using "skipRecords" and "maxRecords," with default "maxRecords" set to 20. "codeName" is required, while "databaseName" and "ownerName" default to session properties. "maxCodeVersion" defaults to the current version, and "minCodeVersion" to the first version.

API actionJSON ADMIN APIJSON ActiondescribeCodePackageHistorydescribeCodePackagesHistorydescribesCodePackageHistorydescribesCodePackagesHistorydescribe code package historycodepackagecode package historyold code packageprevious code packagedeprecated code packagecode versioningget code historyversion historyJSON Action APIview previous code packagehistorical codecode historycode package management
Table 1. describeCodePackageHistory "params" property summaries

Property

Description

Default

Type

Limits (inclusive)

codeFormat

(optional) specifies the encoding of the code in the code property.

"utf8"

string

"utf8"

codeName

specifies the name of the code package.

Required - No default value

string

1 to 64 bytes

databaseName

(optional) specifies the name of the database.

Defaults to the session's "defaultDatabaseName" property

string

1 to 64 bytes

maxCodeVersion

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

Current version

integer

1 to 2147483647

maxRecords

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

20

integer

-1 to 65535

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

skipRecords

(optional) specifies the number or results to skip.

0

integer

0 to 9223372036854775807



"codeFormat" is an optional string that 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.

The "codeName" property is a required, case-sensitive string between 1 and 64 bytes containing 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.

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.

"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".

"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.

"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".