Create or update attribute

POST /PIM/SaveAttributeWithDetail — PIM API · Attributes

Saves an attribute with its settings, type information, and values. If AttributeId is provided, that attribute is updated; if not, a new attribute is created. The saved state of the attribute is returned in the response.

  • If PimSource is empty, it is generated from Name; if both are empty, the request fails.
  • If Detail is not sent, only the name, settings, and validation rules are saved.
  • Values inside ValuesDetail are written as attribute values according to Detail.AttributeTypeId; if ValueId is provided, the value is updated.

Parametreler

  • Tenant (header, string): Company code for users accessing multiple companies with Basic Auth. Not required if using Bearer token.

İstek gövdesi

  • Tag (string): Free tag.
  • Name (string, zorunlu): Attribute name.
  • Detail (object): Type information of the attribute. Use examples from List Attributes response for ID values.
    • Detail.Code (string): Attribute code (max 100 characters). null leaves current value unchanged, empty text clears it.
    • Detail.Sync (boolean): Whether to sync with external system; null leaves current value unchanged.
    • Detail.IsActive (boolean): Is the attribute active.
    • Detail.Description (string): Attribute description.
    • Detail.ExternalCode (string): External system code (max 100 characters). null leaves current value unchanged, empty text clears it.
    • Detail.ValidEndDate (string<date-time>): Validity end date.
    • Detail.ValidStartDate (string<date-time>): Validity start date.
    • Detail.AttributeTypeId (integer): Attribute type ID.
    • Detail.AttributeDataTypeId (integer): Data type ID.
    • Detail.AttributeBindingTypeId (integer): Context type ID.
    • Detail.AttributeRelationLevelId (integer): Relation level ID.
  • Options (object[]): Attribute settings (e.g. allowFiltering, showOnProduct, isSearchable, splitSeperator).
    • Options.Key (string): Setting key.
    • Options.Value (string): Setting value (text, e.g. "True").
  • PimSource (string): PIM source key of the attribute; generated from name if empty.
  • AttributeId (integer): ID of the attribute to update; leave empty for a new attribute.
  • ValuesDetail (object[]): Attribute values.
  • ValidationRules (object[]): Validation rules to apply.
    • ValidationRules.ValidationOrder (integer): Order of the rule.
    • ValidationRules.ValidationRuleId (integer): Validation rule ID.

Yanıtlar

  • 200: Saved state of the attribute.
  • 400: Request body is not valid JSON or field types are incompatible.
  • 401: Authentication failed (missing header, incorrect Basic credentials, or invalid token). Body is empty.
  • 500: Save error (e.g. company not found, Map name cannot be empty, attribute not found).

200 yanıt alanları

  • Code (string): Attribute code.
  • Name (string): Attribute name.
  • Sync (boolean): Is synced with external system.
  • Type (string): Record type; Attribute for attributes.
  • Detail (object): Type information of the attribute.
  • Options (object[]): Attribute settings; returns all defined setting keys, unset ones have null values.
    • Options.Key (string): Setting key.
    • Options.Value (string): Setting value.
  • IsSynced (boolean): Was the last sync successful.
  • MetaType (string): Additional type information.
  • PimSource (string): PIM source key.
  • AttributeId (integer): Attribute ID.
  • ExternalCode (string): External system code.
  • LastSyncDate (string<date-time>): Last sync time.
  • ValuesDetail (object[]): Attribute values.
  • LocalizedName (object[]): Language translations of the attribute name.
  • ValidationRules (object[]): Linked validation rules.