Skip to main content

"listCodePackages"

JSON ADMIN "listCodePackages" action returns a list of code packages that match all specified filters

The "listCodePackages" action returns a list of code packages that match all the specified filters.

Each returned item in the list contains all code package properties except the "code" property. This action helps the user find the current code package. If you want to retrieve the source code, use the "describeCodePackages" action.

Request examples

{ 
  "api": "admin",
  "action": "listCodePackages",
  "params": {
    "databaseName": "faircom",
    "ownerName": "admin",
    "partialName": "convert",

    "codeTypeFilter": [ "getRecordsTransform", "expression" ],
    "statusFilter": [
      "developing",
      "deleted",
      "inactive",
      "deprecated",
      "testing",
      "active"
    ],
    "includeDeactivatedCode": true,

    "commentFilter": "words, phrases, NEAR, full-text search",
    "descriptionFilter": "words, phrases, NEAR, full-text search",
    "metadataFilter": "words, phrases, NEAR, full-text search",

    "skipRecords": 100,
    "maxRecords": 25
  },
  "authToken": "replaceWithAuthTokenFromCreateSession"
}
{ 
  "api": "admin",
  "action": "listCodePackages",
  "params": {},
  "authToken": "replaceWithAuthTokenFromCreateSession"
}
{ 
  "api": "admin",
  "action": "listCodePackages",
  "params": {
    "codeTypeFilter": ["getRecordsTransform"],
    "statusFilter": ["developing"],
    "includeDeactivatedCode": true
  },
  "authToken": "replaceWithAuthTokenFromCreateSession"
}
{
  "authToken": "replaceWithValidAuthToken",
  "result": {
    "data": []
  },
  "debugInfo": {
    "request": {
      "authToken": "replaceWithAuthTokenFromCreateSession",
      "api": "admin",
      "action": "listCodePackages",
      "params": {
        "databaseName": "faircom",
        "ownerName": "admin",
        "partialName": "convert",
        "codeTypeFilter": [
          "getRecordsTransform",
          "expression"
        ],
        "statusFilter": [
          "developing",
          "deleted", 
          "inactive",
          "deprecated",
          "testing",
          "active"
        ],
        "includeDeactivatedCode": true,
        "commentFilter": "words, phrases, NEAR, full-text search",
        "descriptionFilter": "words, phrases, NEAR, full-text search",
        "metadataFilter": "words, phrases, NEAR, full-text search",
        "skipRecords": 100,
        "maxRecords": 25
      },
      "debug": "max"
    }
  },
  "errorCode": 0,
  "errorMessage": ""
}
{
  "authToken": "replaceWithValidAuthToken",
  "result": {
    "data": [
      {
        "codeId": 6,
        "databaseName": "faircom",
        "ownerName": "admin",
        "codeName": "convertAndCategorizeTemperature",
        "codeVersion": 1,
        "clonedCodeId": 4,
        "codeStatus": "deleted",
        "codeLanguage": "javascript",
        "codeType": "getRecordsTransform",
        "description": "",
        "metadata": {
          "keyword": "temperature",
          "favorites": true
        },
        "createdBy": "ADMIN",
        "createdOn": "2024-10-15T19:58:42.471",
        "updatedBy": "ADMIN",
        "updatedOn": "2024-10-15T19:58:42.471",
        "comment": "",
        "codeFormat": "utf8"
      },
      {
        "codeId": 4,
        "databaseName": "faircom",
        "ownerName": "admin",
        "codeName": "convertTemperature",
        "codeVersion": 2,
        "clonedCodeId": 0,
        "codeStatus": "deleted",
        "codeLanguage": "javascript",
        "codeType": "getRecordsTransform",
        "description": "",
        "metadata": {
          "keyword": "temperature",
          "favorites": true
        },
        "createdBy": "ADMIN",
        "createdOn": "2024-10-15T19:29:34.216",
        "updatedBy": "ADMIN",
        "updatedOn": "2024-10-15T19:56:49.879",
        "comment": "",
        "codeFormat": "utf8"
      },
      {
        "codeId": 5,
        "databaseName": "faircom",
        "ownerName": "admin",
        "codeName": "convertTemperature V2",
        "codeVersion": 1,
        "clonedCodeId": 4,
        "codeStatus": "developing",
        "codeLanguage": "javascript",
        "codeType": "getRecordsTransform",
        "description": "",
        "metadata": {},
        "createdBy": "ADMIN",
        "createdOn": "2024-10-15T19:58:19.699",
        "updatedBy": "ADMIN",
        "updatedOn": "2024-10-15T19:58:19.699",
        "comment": "",
        "codeFormat": "utf8"
      },
      {
        "codeId": 3,
        "databaseName": "faircom",
        "ownerName": "admin",
        "codeName": "convertTemperature new",
        "codeVersion": 2,
        "clonedCodeId": 0,
        "codeStatus": "active",
        "codeLanguage": "javascript",
        "codeType": "getRecordsTransform",
        "description": "optional new description",
        "metadata": {},
        "createdBy": "ADMIN",
        "createdOn": "2024-10-15T19:26:35.218",
        "updatedBy": "ADMIN",
        "updatedOn": "2024-10-15T19:27:28.192",
        "comment": "optional change comment",
        "codeFormat": "utf8"
      }
    ]
  },
  "debugInfo": {
    "request": {
      "authToken": "replaceWithAuthTokenFromCreateSession",
      "api": "admin",
      "action": "listCodePackages",
      "params": {},
      "debug": "max"
    }
  },
  "errorCode": 0,
  "errorMessage": ""
}
{
  "authToken": "replaceWithValidAuthToken",
  "result": {
    "data": [
      {
        "codeId": 5,
        "databaseName": "faircom",
        "ownerName": "admin",
        "codeName": "convertTemperature V2",
        "codeVersion": 1,
        "clonedCodeId": 4,
        "codeStatus": "developing",
        "codeLanguage": "javascript",
        "codeType": "getRecordsTransform",
        "description": "optional new description",
        "metadata": {},
        "createdBy": "ADMIN",
        "createdOn": "2024-10-15T19:58:19.699",
        "updatedBy": "ADMIN",
        "updatedOn": "2024-10-15T19:58:19.699",
        "comment": "optional change comment",
        "codeFormat": "utf8"
      }
    ]
  },
  "debugInfo": {
    "request": {
      "authToken": "replaceWithAuthTokenFromCreateSession",
      "api": "admin",
      "action": "listCodePackages",
      "params": {
        "codeTypeFilter": [
          "getRecordsTransform"
        ],
        "statusFilter": [
          "developing"
        ],
        "includeDeactivatedCode": true
      },
      "debug": "max"
    }
  },
  "errorCode": 0,
  "errorMessage": ""
}

Examples:

To constrain results to include the three words FairCom Edge rocks anywhere in a  comment, use  "commentFilter": "FairCom Edge rocks".

To constrain results to include the exact phrase 'FairCom Edge rocks' and the phrase 'around the clock' in the description, use "descriptionFilter": "'FairCom Edge rocks' 'around the clock'". Notice that a phrase is enclosed in single quotation marks.

To constrain results to include the key value pair "myProperty": "myValue" in the metadata, use the search string, "metadataFilter": "'myProperty' NEAR/0 'myValue'". Notice that NEAR/0 specifies no intervening words or phrases. If you want to allow a maximum of one intervening word, use NEAR/1. You can specify a maximum of any number of intervening words. 

To constrain results to include the word FairCom as the first word plus the word rocks anywhere else in the description, use the search string, "descriptionFilter": "^FairCom rocks". The ^ operator followed by a word or phrase can only be included once in a full-text expression.

Use the listCodePackages API action to return a list of code packages that match all the specified filters

API actionJSON ADMIN APIjsonActionlistCodePackageslistCodePackagelistsCodePackageslistsCodePackagelist code packagescodepackage
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

partialName

returns code packages with names that match its value

""

string

codeTypeFilter

returns code packages with a code type that matches one of the values in the array

[]

array

statusFilter

returns code packages with statuses that match one of the values in the array

[]

array

"developing"
"deleted"
"inactive"
"deprecated"
"testing"
"active"

includeDeactivatedCode

specifies whether or not the results include deactivated code packages

null

Boolean

true
false

descriptionFilter

returns code packages with descriptions that match the full-text search in "descriptionFilter"

null

string

metadataFilter

returns code packages with metadata that match the full-text search in the "metadataFilter"

null

string

commentFilter

returns code packages with comments that match the full-text search in "commentFilter"

null

string

skipRecords

specifies the number of results to skip

0

integer

maxRecords

specifies the maximum number of results to return

20

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

"partialName" is an optional query filter that returns code packages with code names that match the value of "partialName". The match starts at the name's beginning, making it a "starts with" match instead of a "substring" match. If the partial name is empty, null, or omitted, it matches all names.

"codeTypeFilter" is an optional query filter with an array of code types. If the array is empty, null, or omitted, it matches all code types; otherwise, it returns code packages with a code type that matches one of the array's values.

"statusFilter" is an optional query filter consisting of an array of status values. If the array is empty, null, or omitted, it matches all status values; otherwise, it returns code packages only when their status matches one of the values in the array. If "includeDeactivatedCode" is set to true or false, it overrides conflicting status codes.

"includeDeactivatedCode" is an optional query filter that is a Boolean value. It defaults to null. The results include activated and deactivated code packages if this value is null or omitted. If set to true, the results only include deactivated code packages. If set to false, the results only include activated code packages.

"commentFilter" is an optional query filter that is a string value. It defaults to null. If this value is not null or omitted, the results only include code packages with comments that match the full-text search specified in the "commentFilter" property. See Full-text filter expressions.

"descriptionFilter" is an optional string value that defaults to null. If the value is not null or omitted, the results only include code packages with descriptions that match the full-text search specified in the "descriptionFilter" property. See Full-text filter expressions.

"metadataFilter" is an optional string value that defaults to null. If the value is not null or omitted, the results only include code packages with metadata that match the full-text search specified in the "metadataFilter" property. See Full-text filter expressions. A code package's "metadata" property contains a JSON object with user-defined key-value pairs.

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

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