"cloneCodePackage"
JSON ADMIN "cloneCodePackage"
action creates a new code package with a new name and copies an existing code package into it
The "cloneCodePackage" action creates a new code package with a new name and copies an existing code package into it. You can optionally modify the new code package's status and properties.
Request examples
{ "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" }
{ "api": "admin", "action": "cloneCodePackage", "params": { "codeName": "convertTemperature", "newCodeName": "convertAndCategorizeTemperature", "comment": "Cloned from convertTemperature" }, "authToken": "replaceWithAuthTokenFromCreateSession" }
{ "authToken": "replaceWithValidAuthToken", "debugInfo": { "request": { "authToken": "replaceWithAuthTokenFromCreateSession", "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" } }, "errorCode": 0, "errorMessage": "" }
{ "authToken": "replaceWithValidAuthToken", "debugInfo": { "request": { "authToken": "replaceWithAuthTokenFromCreateSession", "api": "admin", "action": "cloneCodePackage", "params": { "codeName": "convertTemperature", "newCodeName": "convertAndCategorizeTemperature", "comment": "Cloned from convertTemperature" }, "debug": "max" } }, "errorCode": 0, "errorMessage": "" }
Use the cloneCodePackage API action to create a new code package with a new name and copies an existing code package into it
Property | Description | Default | Type | Limits (inclusive) | ||||||
---|---|---|---|---|---|---|---|---|---|---|
specifies the name of the database | Defaults to the session's | string | ||||||||
specifies the name of the owner | Defaults to the session's | string | ||||||||
specifies the name of the code package | Required - No default value | string | ||||||||
when specified, the server clones the code package into another database |
| string | ||||||||
when specified, the server assigns the cloned code package to the new owner name |
| string | ||||||||
when specified, the server renames the code package to the new name |
| string | ||||||||
specifies the programming language of the code in the | Required - No default value | enum |
| |||||||
specifies how and where a FairCom server can run the JavaScript code | Required - No default value | enum |
| |||||||
specifies the status of the code. The server only runs code with a status of |
| enum |
| |||||||
describes the code package |
| string | ||||||||
contains user-defined properties that add keywords and tags about the code package |
| string | ||||||||
describes the latest change to the code |
| string | ||||||||
specifies the encoding of the code in the code property |
| string |
| |||||||
contains the source code stored in the server |
| Json string |
"databaseName"
is an optional string specifying the database name of the code package. It defaults to the session's "defaultDatabaseName"
property when omitted or set to null
. The package's unique identifier is the combination of "databaseName"
, "ownerName"
, and "codeName"
.
"ownerName"
is an optional string specifying the account name that owns the code package. It defaults to the session's "defaultOwnerName"
property when omitted or set to null
. The package's unique identifier is the combination of "databaseName"
, "ownerName"
, and "codeName"
.
"codeName"
is a required string containing the user-defined name for the code package. The package's unique identifier is the combination of "databaseName"
, "ownerName"
, and "codeName"
.
"newDatabaseName"
is an optional string. When present, the server uses the new database as the target for the action. When null
or omitted, the server runs the action in the current database.
"newOwnerName"
is an optional string. When present, the server uses the new owner name as the target for the action. When null
or omitted, the server runs the action using the current owner name.
"newCodeName"
is an optional string. When present, the server renames the code package from the current "codeName"
to the "newCodeName"
. The server does not change the "codeName"
when null
or omitted.
"codeLanguage"
is a required string. It is the programming language's name. Any string value is accepted. Currently, "javascript"
and "json"
are the only types of code the FairCom server can use.
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:
"integrationTableTransform"
runs JavaScript code when a record is inserted into an integration table."getRecordsTransform"
runs JavaScript code when a"getRecords..."
action is called.
"codeStatus"
is optional and 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".
"description"
is an optional string that describes the code package. The server indexes this field with a full-text index so that you can search for any word or phrase.
"metadata"
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.
"comment"
is an optional string explaining the code change.
"codeFormat"
is an optional string that specifies the encoding of code in the code property. You must encode you 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
.
"code"
contains the source code. Before embedding it in a JSON string, encode the source code using the format specified in the "codeFormat"
property.