You can optionally modify the new code package's status and properties.
Request examples
Typical
{
"api": "admin",
"action": "cloneCodePackage",
"params": {
"databaseName": "faircom",
"ownerName": "admin",
"codeName": "convertTemperature",
"newDatabaseName": "faircom",
"newOwnerName": "admin",
"newCodeName": "convertTemperature V2",
"codeStatus": "developing",
"comment": "optional change comment",
"description": "optional new description",
"metadata": {}
},
"authToken": "replaceWithAuthTokenFromCreateSession"
}Clone a package
{
"api": "admin",
"action": "cloneCodePackage",
"params": {
"codeName": "convertTemperature",
"newCodeName": "convertAndCategorizeTemperature",
"comment": "Cloned from convertTemperature"
},
"authToken": "replaceWithAuthTokenFromCreateSession"
}
Response examples
Typical
{
"debugInfo": {
"request": {
"api": "admin",
"action": "cloneCodePackage",
"params": {
"databaseName": "faircom",
"ownerName": "admin",
"codeName": "convertTemperature",
"newDatabaseName": "faircom",
"newOwnerName": "admin",
"newCodeName": "convertTemperature V2",
"codeStatus": "developing",
"comment": "optional change comment",
"description": "optional new description",
"metadata": {}
},
"debug": "max",
"authToken": "replaceWithAuthTokenFromCreateSession"
}
},
"errorCode": 0,
"errorMessage": "",
"authToken": "replaceWithAuthTokenFromCreateSession"
}Clone a package
{
"debugInfo": {
"request": {
"api": "admin",
"action": "cloneCodePackage",
"params": {
"codeName": "convertTemperature",
"newCodeName": "convertAndCategorizeTemperature",
"comment": "Cloned from convertTemperature"
},
"debug": "max",
"authToken": "replaceWithAuthTokenFromCreateSession"
}
},
"errorCode": 0,
"errorMessage": "",
"authToken": "replaceWithAuthTokenFromCreateSession"
}
Properties
Request properties ("params")
| Property | Description | Default | Type | Limits (inclusive) |
|---|---|---|---|---|
codeName |
The It is an error to set The package's unique identifier is the combination of |
Required - No default value | string | 1 to 64 bytes |
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". |
Optional with default of "developing"
|
string |
|
comment |
The "comment" property explains the code change. |
Optional with default of ""
|
string | 1 to 65,535 bytes |
databaseName |
The 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 It is an error to set If no default database is specified during |
Defaults to the session's "defaultDatabaseName" property |
string | 1 to 64 bytes |
description |
The "description" property describes objects such as code packages, labels, or things. The server indexes this field with a full-text index so that you can search for any word or phrase. You cannot use this property for filtering in the Thing API. |
Optional with default of
|
string |
0 to 65,500 bytes 1 to 512 bytes for the Thing API |
metadata |
The "metadata" property contains user-defined properties that add keywords and tags about the code package. The server indexes this field with a full-text index so you can search for any word or phrase to find code packages. |
Optional with default of {}
|
object | 0 or more key/value pairs |
newCodeName |
The "newCodeName" property causes the server to rename the code package from the current "codeName" to the "newCodeName". The server does not change the "codeName" when null or omitted. |
Optional with default of null
|
string | 1 to 64 bytes |
newDatabaseName |
The "newDatabaseName" property causes the server to use the new database as the target for the action. When null or omitted, the server runs the action in the current database. |
Optional with default of null
|
string | 1 to 64 bytes |
newOwnerName |
The "newOwnerName" property causes the server to use the new owner name as the target for the action. When null or omitted, the server runs the action using the current owner name. |
Optional with default of null
|
string | 1 to 64 bytes |
ownerName |
The 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 If no default owner is specified during |
Optional with default of the session's "defaultOwnerName" property |
string | 1 to 64 bytes |