**版本：202201**

# 更新元字段

**PATCH** `/openapi/2022-01/:resource/:resource_id/metafields/:id`

## 请求

**Path参数**

- `resource` string (required)

  The type of resource that the metafield is attached to. Available resources: `shop`, `product`, `product_image`, `product_variant`, `order`, `page`, `customer`, `collection`, `blog`, `article`.
- `resource_id` string (required)

  The unique ID of the resource that the metafield is attached to.
- `id` string (required)

  Metafield's ID

**application/json**

**请求体 | 示例**

**请求体**

- `value` string (required)

  The data to store in the metafield.
- `type` string (required)

  The type of data that the metafield stores in the `value` field.
- `description` string

  A description of the information that the metafield contains.

```json
{
  "value": "string",
  "type": "string",
  "description": "string"
}
```

## 响应

**200 | 400 | 404**

200

**application/json**

**数据结构 | 示例 | Result**

**数据结构**

- `metafield` object

  - `id` string

    **示例：** `374050809094090794`
  - `store_id` integer

    **默认值：** `0`

    **示例：** `633130`
  - `created_at` string

    **示例：** `2024-04-28T06:50:19Z`
  - `updated_at` string

    **示例：** `2024-04-28T09:33:12.018134337Z`
  - `owner_resource` string

    **示例：** `product`
  - `owner_id` string

    **示例：** `a1a88be0-a1d4-47e4-a2f2-ba6e131cf447`
  - `namespace` string

    **示例：** `shirt`
  - `key` string

    **示例：** `weight`
  - `type` string

    **示例：** `weight`
  - `value` string

    **示例：** `30`
  - `description` string

    **示例：**
  - `definition_id` string

    **示例：** `0`

```json
{
  "metafield": {
    "id": "374050809094090794",
    "store_id": 633130,
    "created_at": "2024-04-28T06:50:19Z",
    "updated_at": "2024-04-28T09:33:12.018134337Z",
    "owner_resource": "product",
    "owner_id": "a1a88be0-a1d4-47e4-a2f2-ba6e131cf447",
    "namespace": "shirt",
    "key": "weight",
    "type": "weight",
    "value": "30",
    "description": "",
    "definition_id": "0"
  }
}
```

```json
{
  "metafield": {
    "id": "374050809094090794",
    "store_id": 633130,
    "created_at": "2024-04-28T06:50:19Z",
    "updated_at": "2024-04-28T09:33:12.018134337Z",
    "owner_resource": "product",
    "owner_id": "a1a88be0-a1d4-47e4-a2f2-ba6e131cf447",
    "namespace": "shirt",
    "key": "weight",
    "type": "weight",
    "value": "30",
    "description": "",
    "definition_id": "0"
  }
}
```

400

**text/plain**

无 Schema

404

**text/plain**

无 Schema
