"describeCodePackages" (JSON Action)
Return information about specified code packages
The "describeCodePackages" action returns all the current information about the specified code package names including source code and package properties.
Use "describeCodePackageHistory" to retrieve information about previous versions of a code package.
Links: Concepts | Tutorials | FAQs
Request examples
Typical
{
"api": "admin",
"action": "describeCodePackages",
"params": {
"databaseName": "faircom",
"ownerName": "admin",
"codeNames": [ "convertTemperature" ],
"codeFormat": "utf8 | base64 | hex | byteArray | json"
},
"authToken": "replaceWithAuthTokenFromCreateSession"
}
{
"api": "admin",
"action": "describeCodePackages",
"params": {
"codeNames": ["convertTemperature"]
},
"authToken": "replaceWithAuthTokenFromCreateSession"
}
{
"result": {
"data": [
{
"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",
"code": "// The server runs this JavaScript code, which is registered in the server as a transform method.\nrecord.temperature_fahrenheit = record.source_payload.temperature\nrecord.temperature_celsius = getCelsiusFromFahrenheit(record.temperature_fahrenheit)\nrecord.temperature_status = calculateTemperatureStatus(record.temperature_fahrenheit)\n\nfunction getCelsiusFromFahrenheit(temperature_fahrenheit){\n return (temperature_fahrenheit - 32) / 1.8;\n}\n\nfunction calculateTemperatureStatus(temperature_fahrenheit){\n switch (true) {\n case (temperature_fahrenheit < 0):\n return \"alert: too cold\";\n case (temperature_fahrenheit < 32):\n return \"cold\";\n case (temperature_fahrenheit > 80):\n return \"hot\";\n case (temperature_fahrenheit > 140):\n return \"alert: too hot\";\n default:\n return \"normal\";\n }\n}"
}
]
},
"debugInfo": {
"request": {
"api": "admin",
"action": "describeCodePackages",
"params": {
"databaseName": "faircom",
"ownerName": "admin",
"codeNames": [
"convertTemperature"
],
"codeFormat": "utf8 | base64 | hex | byteArray | json"
},
"debug": "max",
"authToken": "replaceWithAuthTokenFromCreateSession"
}
},
"errorCode": 0,
"errorMessage": "",
"authToken": "replaceWithAuthTokenFromCreateSession"
}
{
"result": {
"data": [
{
"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",
"code": "// The server runs this JavaScript code, which is registered in the server as a transform method.\nrecord.temperature_fahrenheit = record.source_payload.temperature\nrecord.temperature_celsius = getCelsiusFromFahrenheit(record.temperature_fahrenheit)\nrecord.temperature_status = calculateTemperatureStatus(record.temperature_fahrenheit)\n\nfunction getCelsiusFromFahrenheit(temperature_fahrenheit){\n return (temperature_fahrenheit - 32) / 1.8;\n}\n\nfunction calculateTemperatureStatus(temperature_fahrenheit){\n switch (true) {\n case (temperature_fahrenheit < 0):\n return \"alert: too cold\";\n case (temperature_fahrenheit < 32):\n return \"cold\";\n case (temperature_fahrenheit > 80):\n return \"hot\";\n case (temperature_fahrenheit > 140):\n return \"alert: too hot\";\n default:\n return \"normal\";\n }\n}"
}
]
},
"debugInfo": {
"request": {
"api": "admin",
"action": "describeCodePackages",
"params": {
"codeNames": [
"convertTemperature"
]
},
"debug": "max",
"authToken": "replaceWithAuthTokenFromCreateSession"
}
},
"errorCode": 0,
"errorMessage": "",
"authToken": "replaceWithAuthTokenFromCreateSession"
}
The "describeCodePackages" action retrieves information about specified code packages, including source code and properties. It takes parameters like "databaseName", "ownerName", and "codeNames". The response includes details like "codeId", "codeVersion", "codeStatus", "codeLanguage", and the actual "code" content. The "codeFormat" parameter specifies the encoding of the code, defaulting to "utf8". "codeName" is required, while "databaseName" and "ownerName" are optional and default to session properties.
"params" property summariesProperty | Description | Default | Type | Limits (inclusive) |
|---|---|---|---|---|
(optional) specifies the encoding of the code in the code property. |
| string |
| |
specifies the names of the code packages. | Required - No default value | array of strings | 1 or more strings | |
(optional) specifies the name of the database. | Defaults to the session's | string | 1 to 64 bytes | |
(optional) specifies the name of the owner. | Defaults to the session's | string | 1 to 64 bytes |
"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 "codeNames" property is a required array of strings specifying the names of the code packages you want to be described.
"params": {
"codeNames": [
"convertTemperature"
]
},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.
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.
"result" property summariesProperty | Description | Type | Contents |
|---|---|---|---|
indicates which copy the specified code package is out of all current clones. | integer | The cloned code ID. | |
indicates the version of the code package. | integer | The version of the specified code package. | |
indicates the name of the account used to create the code package. | string | The name of the account used to create the code package. | |
indicates the date and time the code package was created. | timestamp | The date and time when the code package was created. | |
lists each code package with its associated properties and values. | array of objects | An object for each code package. | |
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. | |
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"
},
]