Create an index attribute

post

/gsadmin/v1/{appName}/attributes/{owner}/{attributeName}

Creates a new attribute in the specified config owner attributes list.

Request

Supported Media Types
Path Parameters
Body ()
The attribute to create.
Root Schema : Attribute
Type: object
Represents an index attribute. The object conforms to one of the following ecr-types:
  • dimension
  • property
  • derived-property
Show Source
Nested Schema : context
Type: array
Show Source
Nested Schema : DisplayConfig
Type: object
Contains configuration on how to display an attribute and its values.
Show Source
  • This defines a list of sort options for sorting the values of this dimension. Each sort option is specified by a sort function, comma, sort order. Multiple sort options are separated by semicolons and any number of sort options may be specified. Possible sort functions are 'alpha', 'freq', and 'rank' and sort orders are 'asc' and 'desc'. For example, to sort by rank ascending and break ties by frequency descending use 'rank,asc;freq,desc'.
Nested Schema : indexingTransforms
Type: array
Show Source
  • IndexingTransform
    Specifies a transformation to apply upon one or more source properties (inputs). The attribute which defines the transform is the destination property.
Nested Schema : SeoConfig
Type: object
Contains configuration on which dimensions are included in SEO links. Respected only if using SeoUrlFormatterFactory.
Show Source
Nested Schema : sourcePropertyNames
Type: array
Show Source
Nested Schema : IndexingTransform
Type: object
Specifies a transformation to apply upon one or more source properties (inputs). The attribute which defines the transform is the destination property.
Show Source
  • The outputs of an indexing transform are made unique by suppressing any values that repeat existing assignments.
  • Discard the input properties that were used to generate the transform's output.
  • sourcePropertyNames
    An ordered list of inputs that the transform will consume. In the case of 'concatenate' transform, the first sourceProperty's value will appear first in the output value. If omitted, or identical to the output property name, then the transform happens in-place (an Identity Transform). The type 'split-jsonpath' is only supported as an Identity Transform.
  • List of JSON paths into the source properties from which to extract values. Only applies to 'split-jsonpath' transform
  • Regular expression that describes all delimiters between values. Only applies to 'split-regex' transform.
  • Allowed Values: [ "concatenate", "split-regex", "split-jsonpath" ]
    The specific type of transformation:
    • concatenate: combines the values from the source properties into a single value, in the order that the source properties are specified. If any source properties have contextual (localized) values, then a separate output value shall be produced, restricting its inputs on a per-locale basis.
    • split-regex: Separates the source properties' values into pieces based on the regex that encodes the separator value. Each piece becomes a distinct output value.
    • split-jsonpath: Uses the supplied json paths to extract scalar values from source properties whose values contain json. Each scalar becomes an assignment in the output property. NOTE: 'split-jsonpath' is only supported as an Identity Transform.
  • Once source properties have been split into pieces via regular expression, remove whitespace from the ends of the pieces. Only applies to split-regex transform.
Example:
{
    "transform":"split-jsonpath",
    "splitPaths":[
        "$['product.childSKUs'][*]['sku.id]",
        "$['product.childSKUs'][*]['shoe.size']",
        "$['product.childSKUs'][*]['shirt.size']"
    ]
}
Nested Schema : sourcePropertyNames
Type: array
An ordered list of inputs that the transform will consume. In the case of 'concatenate' transform, the first sourceProperty's value will appear first in the output value. If omitted, or identical to the output property name, then the transform happens in-place (an Identity Transform). The type 'split-jsonpath' is only supported as an Identity Transform.
Show Source
Security
Back to Top

Response

Supported Media Types

201 Response

Index attribute successfully created.
Body ()
Root Schema : Response
Type: object
Show Source
Back to Top

Examples

Request Body Example

The following shows a sample request body to create an attribute with ecr-type: ???property??? in the specified owner index attributes list.

:content = {
  ecr:lastModifiedBy: "admin",
  propertyDataType: "ALPHA",
  ecr:lastModified: "2017-10-15T15:50:27.062Z",
  sourcePropertyNames: [
    "camera.Aperture range"
  ],
  ecr:createDate: "2017-10-15T15:50:26.839Z",
  ecr:type: "property"
}

The following shows a sample request body to create an attribute with ecr-type: ???dimension??? in the specified owner index attributes list. The displayConfig parameter specifies that dimension values in this dimension are sorted in descending order of frequency; ties are sorted in ascending alphabetical order.

{
	"camera.color": {
		"isWildcardEnabledInRecordSearch": true,
		"displayOrder": 4,
		"displayConfig": {
			"sort": "freq,desc;alpha,asc"
		},
		"sourcePropertyNames": ["camera.Color of product"],
		"isAutogen": true,
		"isRecordSearchEnabled": true,
		"ecr:type": "dimension",
		"mergeAction" : "update"
	}
}
Back to Top