Skip to main content

listCodePackages

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

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

    "codeTypeFilter": [ "transform", "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
  }
}
Minimal example - list all code packages
{
  "authToken": "MyTokenHere",
  "api": "admin",
  "action": "listCodePackages",
  "params": {}
}
Example - list some code packages
{
  "authToken": "MyTokenHere",
  "api": "admin",
  "action": "listCodePackages",
  "params": {
    "codeTypeFilter": ["transform"],
    "statusFilter": ["developing"],
    "includeDeactivatedCode": true
  }
}

"partialName" returns items with names that match the value of "partialName". The match starts at the beginning of the name which makes 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 array of code types. It returns items with a code type that matches one of the values in the array. If the array is empty, null, or omitted, it matches all code types.

"statusFilter" is an optional array of status values. If the array is empty, null, or omitted, it matches all status values; otherwise, it returns items only when they have a status that matches one of the values included in the array. If "includeDeactivatedCode" is set to true or false, it overrides conflicting status codes.

"includeDeactivatedCode" is an optional Boolean value that defaults to null. If this value is set to null or omitted, the results include the activated and deactivated code package. If set to true, the results only include the deactivated code package. If set to false, the results only include the activated code package.

"commentFilter" is an optional string value that defaults to null. If this value is not set to null or omitted, the results will only include code packages that match the full-text search of the code's comment. See Full-text filter expressions.

"descriptionFilter" is an optional string value that defaults to null. If the value is not set to null or omitted, the results will only include code packages that match the full-text search of the code's description. See Full-text filter expressions.

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

Full-text filter expressions

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.