Skip to main content

"listLabelGroups" (JSON Action)

Retrieve a list of all the groups used by the existing labels

Tip

If your application plans on creating many groups, you can use a delimiter character, such as the forward slash / in your group names to create a group hierarchy. Include the delimiter after each part of the hierarchy and at the end of the group name. You can use the "partialGroupFilter" filter to return subsets of groups in the hierarchy. For example, you if have groups named "product/size/", "product/weight/", "product/ranking/", "person/gender/", and "person/ranking/", you can set the "partialGroupFilter" filter to "product/" to return the product groups.

Request examples

Minimal

{
  "api": "admin",
  "action": "listLabelGroups",
  "params": { },
  "authToken": "replaceWithAuthTokenFromCreateSession"
}
{
  "api": "admin",
  "action": "listLabelGroups",
  "params": {
    "partialGroupFilter": "my group"
  },
  "responseOptions": {
    "dataFormat": "objects",
    "numberFormat": "string",
    "binaryFormat": "hex"
  },
  "authToken": "replaceWithAuthTokenFromCreateSession",
  "apiVersion": "1.0",
  "requestId": "2",
  "debug": "max"
}
{
  "result": {
    "groups": []
  },
  "requestId": "2",
  "debugInfo": {
    "request": {
      "authToken": "authToken",
      "api": "admin",
      "action": "listLabelGroups",
      "params": {
        "partialGroupFilter": "my group"
      },
      "apiVersion": "1.0",
      "requestId": "2",
      "responseOptions": {
        "dataFormat": "objects",
        "numberFormat": "string",
        "binaryFormat": "hex"
      },
      "debug": "max"
    }
  },
  "authToken": "authToken",
  "errorCode": 0,
  "errorMessage": ""
}

The "listLabelGroups" action retrieves a list of all the groups used by the existing labels

list label grouplistLabelGroupslist groupslabel APIJSON Actionlabel groupsget label groupslabel managementgroup hierarchypartialGroupFilter
Table 1. listLabelGroups "params" property summaries

Property

Description

Default

Type

Limits (inclusive)

deprecatedFilter

(optional) includes deprecated labels when true.

false

Boolean

true
false
null

enumFilter

(optional) is an array of enum integers that specifies which labels to list or change.

[]

array of smallints

Each array item is an integer from -32768 to 32767

groupFilter

(optional) is an array of groups that specifies which labels to list or change.

[]

array of strings

1 or more strings, each up to 64 bytes long.

idFilter

(optional) is an array of IDs that specifies which labels to list or change.

[]

array of integers

Each array item is an integer from 0 to 2147483647

includeDescription

(optional) specifies whether to include the "description" property in the response.

true

Boolean

true
false
null

includeMetadata

(optional) specifies whether to include the "metadata" property in the response.

true

Boolean

true
false
null

nameFilter

(optional) is an array of label names that specifies which labels to list or change.

[]

array of strings

Each array item is a label string from 1 to 64 bytes

partialGroupFilter

(optional) is a partial or complete group name that specifies which labels to list or change.

""

string

1 to 64 bytes

partialNameFilter

(optional) is a partial or complete label name that specifies which labels to list or change.

null

array of strings

1 or more strings, each up to 64 bytes long.

sequenceFilter

(optional) is an array of sequence numbers that specifies which labels to list or change.

[]

array of doubles

Each array item is a floating point or integer number



The "deprecatedFilter" property optionally filters the results of the "listLabels" and "changeLabels" actions. It defaults to null, to include deprecated and non-deprecated labels; in other words, a value of null provides no filtering. Set it to true to include only deprecated labels and false to include only non-deprecated labels.

The "enumFilter" property optionally filters the results of the "listLabels" and "changeLabels" actions. It defaults to null, which provides no filtering. It is an array of integers with values from -32768 to 32767. The "enum" property of a label must match one of the integers in the array to be included in the results.

The "groupFilter" property optionally filters the results of the "listLabels" and "changeLabels" actions. It defaults to null, which provides no filtering. It is an array of strings, such as "groupFilter": [ "myGroup1", "myGroup2", "" ]. Each string is the name of a group and may be up to 64 bytes long. A label's group must match one of the groups in the array to be included in the results. The empty string "" is a valid group name.

Note

The "groupFilter" and "partialGroupFilter" properties are mutually exclusive.

This example uses a group filter to list all labels with the matching groups.

{
  "api":       "admin",
  "action":    "listLabels",
  "params":    {
    "groupFilter": [ "myGroup1", "myGroup2", "" ]
  },
  "authToken": "replaceWithAuthTokenFromCreateSession"
}

This example uses a group filter to list all labels with the matching groups.

{
  "api":       "admin",
  "action":    "listLabels",
  "params":    {
    "groupFilter": [ "myGroup1", "myGroup2" ],
    "partialNameFilter": "myNa"
  },
  "authToken": "replaceWithAuthTokenFromCreateSession"
}

The "idFilter" property optionally filters the results of the "listLabels" and "changeLabels" actions. It defaults to [], which provides no filtering. It is an array of integers with values from 0 to 2147483647. The "id" property of a label must match one of the integers in the array to be included in the results.

The "idFilter" property is mutually exclusive to the other filter properties. The "listLabels" action returns an error when it is used with other filter properties.

The "includeDescription" property is an optional Boolean that specifies whether to include the "description" property in the response. It defaults to true.

The "includeMetadata" property is an optional Boolean that specifies whether to include the "metadata" property in the response. It defaults to true.

The "nameFilter" property optionally filters the results of the "listLabels" and "changeLabels" actions. It defaults to null, which provides no filtering. It is an array of strings, such as "nameFilter": [ "myName1", "myName2" ]. Each string is the name of a label and may be up to 64 bytes long. A label's name must match one of the names in the array to be included in the results.

Note

The "nameFilter" and "partialNameFilter" properties are mutually exclusive.

The "partialGroupFilter" property optionally filters the results of the "listLabels" and "changeLabels" actions. It defaults to null, which provides no filtering. It is a string, such as "partialGroupFilter": "myGr". The string is the partial or full name of a group and may be up to 64 bytes long. A label's group must match the partial or complete value of this property to be included in the results. The empty string "" and null match all groups.

Note

The "groupFilter" and "partialGroupFilter" properties are mutually exclusive.

Warning

When deleting properties, ensure each partial and full group name in the array properly filters the labels; otherwise, the "changeLabels" action will delete more labels than you want.

The "partialNameFilter" property optionally filters the results of the "listLabels" and "changeLabels" actions. It defaults to null, which provides no filtering. It is an array of strings, such as "partialNameFilter": "myNa". Each string is the partial or full name and may be up to 64 bytes long. A label's name must partially match this value to be included in the results. The empty string "" and null match all groups.

Note

The "nameFilter" and "partialNameFilter" properties are mutually exclusive.

Warning

When deleting properties, ensure the partial name properly filters the labels; otherwise, the "changeLabels" action may delete more or fewer labels than you want.

This example uses a group filter to list all labels with the matching groups.

{
  "api":       "admin",
  "action":    "listLabels",
  "params":    {
    "groupFilter": [ "myGroup1", "myGroup2", "" ],
    "partialNameFilter": "myNa"
  },
  "authToken": "replaceWithAuthTokenFromCreateSession"
}

This example uses a partial name filter to list labels with matching names. The labels may be part of any group.

{
  "api":       "admin",
  "action":    "listLabels",
  "params":    {
    "partialNameFilter": "myNa"
  },
  "authToken": "replaceWithAuthTokenFromCreateSession"
}

The "sequenceFilter" property optionally filters the results of the "listLabels" and "changeLabels" actions. It defaults to [], which provides no filtering. It is an array of doubles. The "sequence" property of a label must match one of the doubles in the array to be included in the results.

Table 2. listLabelGroups "result" property summaries

Property

Description

Type

Contents

deprecated

specifies whether a label is deprecated or not.

Boolean

true
false
null

description

describes a label.

string

1 to 65,500 bytes

enum

assigns an integer number to a label.

smallint

-32768 to 32767

groups

assigns a group to a label to create named lookup lists and tag sets.

string

1 to 64 bytes

id

uniquely identifies each label.

integer

0 to 2147483647

metadata

assigns metadata to a label.

JSON

0 to 65,500 bytes

name

names a label. The name must be unique in its group.

string

1 to 64 bytes

sequence

specifies the numerical order of labels within a group.

float

Any floating point or integer number.

value

assigns a value to a label.

JSON

0 to 65,500 bytes



The "deprecated" property optionally deprecates a label. Set it to true to deprecate a label and false to preserve it. It defaults to false. Deprecating a label is similar to marking a label as deleted.

The "description" property optionally provides additional information about a label. You can use it as internal or external documentation about the meaning, purpose, and usage of a label.

Markdown is a good language for formatting description text. You must ensure the text is compatible with a JSON string. For example, you must escape a double quote character using the backslash character:  \".

The "enum" property optionally assigns an integer from -32768 to 32767 to a label. By default, this property is set to 0. You can use this property to assign an application's hardcoded enumerated value to a label.

The "groups" property lists all active label groups.

  "result": {
    "groups": [
      "group1",
      "group2",
      "group3"
    ]
  },

The "id" property is the unique identifier of a label. In JSON, you may use an integer number or a string containing an integer number. The server automatically generates the "id" when you create a label and stores it in the label table as an integer. You cannot alter the "id" value. If your application needs to specify a specific numeric identifier for a label, use the "enum" property.

The "metadata" field optionally allows a customer to add a JSON value to the label. It is typically a JSON object, but may be any JSON value. It defaults to null. Its purpose is to provide additional metadata about the label, such as translations in multiple languages, historical value changes, etc. The "alterLabel" action can only replace this value with a new JSON value.

The "name" property is the name of a label. It is a required UTF-8 string that is up to 64 bytes long.

The "group" and "name" properties combined uniquely identify each label. The "createLabel" and "alterLabel" actions return an error if the "group" and "name" properties do not create a unique label name.

The "id" property also uniquely identifies each label so you can rename a label's group and name without breaking "id" references to the label.

The "sequence" property optionally assigns an order to the labels in a group. You can use a floating point or integer number. You may embed the number in a JSON string. It defines the order of labels in a group. It is a floating point number to make it easy to change label order without renumbering all labels in a group. For example, to move a label in between two other labels, you can assign a fractional number to the label that is in between the sequence numbers of two other labels.

The "value" property associates a value with a label. It is an optional JSON value that is associated with a label. It can be any JSON value. It defaults to null

When you use the "alterLabel" action to update the "value" property, it replaces "value" with an entirely new value. It cannot replace parts of the JSON value.