younifyd
Menu

Patch Asset Family By Code

Update/create an asset family

PATCH/api/rest/v1/asset-families/{code}

Use it in a workflow

  1. Add a step and choose the Akeneo connector.
  2. Pick the Patch Asset Family By Code action (under Asset family).
  3. Fill in the fields below, then reference the result from later steps as {{patchAssetFamilyByCode.response.data}}.

Request

Path parameters

codestringrequired

This path parameter is used to specify the unique identifier of the entity you want to retrieve or manipulate. It is essential for identifying the specific entity in the API requests. Ensure that the code is correctly formatted and corresponds to an existing entity in the system.

Request body

Enter the body as JSON in the step's Body field.

codestringrequired

Asset family code

labelsobject

Asset family labels for each locale. The `localeCode` must be the code of an existing and activated locale.

Default {}

attribute_as_main_mediastring

Attribute code that is used as the main media of the asset family

Default "First media file or media link attribute that was created"

naming_conventionobject

The naming convention run over the asset code or the main media filename upon each asset creation, in order to automatically set several values in asset attributes. To learn more and see the format of this property, take a look at [here](https://api.akeneo.com/concepts/asset-manager.html#focus-on-the-naming-convention).

Default {}

sourceobject

The string on which the naming convention should be applied. More details [here](https://api.akeneo.com/concepts/asset-manager.html#the-source-string).

patternstring

The regular expression that should be applied on the source. More details [here](https://api.akeneo.com/concepts/asset-manager.html#the-split-pattern).

abort_asset_creation_on_errorboolean

Whether the asset should be created if the naming convention failed to apply. More details [here](https://api.akeneo.com/concepts/asset-manager.html#abortion-on-error).

product_link_rulesarray<object>

The rules that will be run after the asset creation, in order to automatically link the assets of this family to a set of products. To understand the format of this property, see [here](https://api.akeneo.com/concepts/asset-manager.html#focus-on-the-product-link-rule).

Default []

product_selectionsarray<object>5 fields

The product selection to which the assets of the asset family to be automatically linked. More details [here](https://api.akeneo.com/concepts/asset-manager.html#product-selection).

assign_assets_toarray<object>4 fields

The product value in which your assets will be assigned. More details [here](https://api.akeneo.com/concepts/asset-manager.html#product-value-assignment).

transformationsarray<object>

The transformations to perform on source files in order to generate new files into your asset attributes. To understand the format of this property, see [here](https://api.akeneo.com/concepts/asset-manager.html#focus-on-the-transformations).

Default []

labelstringrequired

The name of the transformation

filename_suffixstring

The suffix that will be appended to the source filename to generate the target filename. More details [here](https://api.akeneo.com/concepts/asset-manager.html#target-filename).

filename_prefixstring

The prefix that will be prepended to the source filename to generate the target filename. More details [here](https://api.akeneo.com/concepts/asset-manager.html#target-filename).

sourceobjectrequired3 fields

The attribute value in which is stored the media file you want to use as the source file for your transformation. More details [here](https://api.akeneo.com/concepts/asset-manager.html#source-file).

targetobjectrequired3 fields

The attribute value in which the PIM will generate the new transformed file, aka the target file. More details [here](https://api.akeneo.com/concepts/asset-manager.html#target-file).

operationsarray<object>required2 fields

The transformations that should be applied to your source file to generate the target file. More details [here](https://api.akeneo.com/concepts/asset-manager.html#transformation-operations).

sharing_enabledboolean

Share links are available/unavailable for media file attributes of all the assets in this family

auto_tagging_enabledboolean

Auto-tagging is enabled/disabled for all the assets in this family

json
{
  "code": "model_pictures",
  "labels": {
    "en_US": "Model pictures",
    "fr_FR": "Photographies en pied"
  },
  "attribute_as_main_media": "main_image",
  "naming_convention": {
    "source": {
      "property": "code"
    },
    "pattern": "/(?P<product_ref>.*)-.*/",
    "abort_asset_creation_on_error": true
  },
  "product_link_rules": [
    {
      "product_selections": [
        {
          "field": "sku",
          "operator": "EQUALS",
          "value": "{{product_ref}}"
        }
      ],
      "assign_assets_to": [
        {
          "attribute": "model_pictures",
          "mode": "replace"
        }
      ]
    }
  ],
  "transformations": [
    {
      "label": "Thumbnail plus black and white transformation",
      "filename_suffix": "_thumbnailBW",
      "source": {
        "attribute": "main_image",
        "channel": "ecommerce",
        "locale": "en_US"
      },
      "target": {
        "attribute": "thumbnail",
        "channel": "ecommerce",
        "locale": "en_US"
      },
      "operations": [
        {
          "type": "thumbnail",
          "parameters": {
            "width": 150,
            "height": 150
          }
        },
        {
          "type": "colorspace",
          "parameters": {
            "colorspace": "grey"
          }
        }
      ]
    }
  ],
  "sharing_enabled": true,
  "auto_tagging_enabled": true
}

Response

Returns 201 with a any. Read it in later steps with {{patchAssetFamilyByCode.response.data.<field>}}.

Need more? See the Akeneo guide for connection setup and behaviour shared by every action.