Skip to main content

"revertCodePackage"

JSON ADMIN "revertCodePackage" action reverts the code package to the specified historical version

The "revertCodePackage" action reverts the code package to the specified version in the code package history. The purpose is to provide a fast way to revert back to a known good version when new code is not working well.

When you revert a code package to a previous version, the server copies the current version and puts it into version history as is. It then takes the requested version of code from version history, increments the version, replaces the current code with the code from version history, and starts executing the new code.

Request example

{ 
  "api": "admin",
  "action": "revertCodePackage",
  "params": {
    "databaseName": "faircom",
    "ownerName": "admin",
    "codeName": "convertTemperature",
    "codeVersion": 13
  },
  "authToken": "replaceWithAuthTokenFromCreateSession"
}
{
  "authToken": "replaceWithValidAuthToken",
  "debugInfo": {
    "request": {
      "authToken": "replaceWithAuthTokenFromCreateSession",
      "api": "admin",
      "action": "revertCodePackage",
      "params": {
        "databaseName": "faircom",
        "ownerName": "admin",
        "codeName": "convertTemperature",
        "codeVersion": 1
      },
      "debug": "max"
    }
  },
  "errorCode": 0,
  "errorMessage": ""
}

Use the revertCodePackage API action to revert the code package to the specified version in the code package history

API actionJSON ADMIN APIjsonActionrevertCodePackagerevertCodePackagesrevertsCodePackagerevertsCodePackagesrevert code packagecodepackage
Table 1. Params property summaries

Property

Description

Default

Type

Limits (inclusive)

databaseName

specifies the name of the database

Defaults to the session's "defaultDatabaseName" property

string

ownerName

specifies the name of the owner

Defaults to the session's "defaultOwnerName" property

string

codeName

specifies the name of the code package

Required - No default value

string

codeVersion

specifies the code's version stored in the version history

Required - No default value

integer

 



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

"codeVersion" is a required integer value that specifies the code's version stored in the version history.