## Create update and delete item attributes

### cURL

```bash
curl --request POST \
  --url https://live.copilot.fabric.inc/api-product/v1/product/attribute/bulk \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --header 'x-site-context: <x-site-context>' \
  --data '
[
  {
    "action": "UPDATE",
    "id": "621c1122ff2e4507c199b75d",
    "name": "Weight",
    "locales": [
      {
        "locale": [
          "fr-ca",
          "es-us"
        ],
        "name": "le poids"
      }
    ],
    "description": "Example description.",
    "mapping": "title",
    "serialStart": 1,
    "format": "YYYY-MM-DD",
    "formula": "`${item.weightValue} ${item.weightUnit}`",
    "validation": {
      "required": true,
      "inheritable": true,
      "inverse": true,
      "unique": true,
      "exact": "<string>",
      "attributeTypes": [
        "Serial",
        "Integer"
      ],
      "contains": "Demo",
      "startWith": 1,
      "incrementBy": 1,
      "range": {
        "min": "<string>",
        "max": "<string>"
      },
      "formula": "value < 10 || value > 20",
      "oneOf": [
        "<string>"
      ]
    }
  }
]
'
```

### Python Code

```python
import requests

url = "https://live.copilot.fabric.inc/api-product/v1/product/attribute/bulk"

payload = [
    {
        "action": "UPDATE",
        "id": "621c1122ff2e4507c199b75d",
        "name": "Weight",
        "locales": [
            {
                "locale": ["fr-ca", "es-us"],
                "name": "le poids"
            }
        ],
        "description": "Example description.",
        "mapping": "title",
        "serialStart": 1,
        "format": "YYYY-MM-DD",
        "formula": "`${item.weightValue} ${item.weightUnit}`",
        "validation": {
            "required": True,
            "inheritable": True,
            "inverse": True,
            "unique": True,
            "exact": "<string>",
            "attributeTypes": ["Serial", "Integer"],
            "contains": "Demo",
            "startWith": 1,
            "incrementBy": 1,
            "range": {"min": "<string>", "max": "<string>"},
            "formula": "value < 10 || value > 20",
            "oneOf": ["<string>"]
        }
    }
]
headers = {
    "x-site-context": "<x-site-context>",
    "Authorization": "Bearer <token>",
    "Content-Type": "application/json"
}

response = requests.post(url, json=payload, headers=headers)

print(response.text)
```

### Response Format

```json
{
  "attributes": {
    "success": [
      {
        "id": "622932439c73c975335cb654",
        "name": "name",
        "message": "Attribute created successfully"
      }
    ],
    "failed": [
      {
        "name": "ITEM_ATTRIBUTE_VALUE_IS_INVALID",
        "errors": [
          [
            "Attribute value is invalid",
            "Attribute value not found"
          ]
        ]
      }
    ]
  }
}
```

### Error Responses

```json
{
  "code": 400,
  "message": "Client error"
}
```

```json
{
  "code": 500,
  "message": "An internal error occurred. If the issue persists please contact support@fabric.inc."
}
```
