**Version: 202201**

# Update Procurement

**PUT** `/openapi/2022-01/procurements/:id`

Allows updating the details of an existing procurement record, such as its supplier, note, or other properties.

## Request

**Path Parameters**

- `id` string (required)

  Procurement's ID

**application/json**

**Body | Example**

**Body**

- `procurement` object

  - `supplier_id` string

    Supplier's ID
  - `note` string

```json
{
  "procurement": {
    "supplier_id": "string",
    "note": "string"
  }
}
```

## Responses

**200 | 400 | 404 | 422**

200

**application/json**

**Schema | Example | Result**

**Schema**

- `procurement` object

  - `id` string

    **Example:** `382451985837728044`
  - `procurement_sn` string

    **Example:** `00000002`
  - `supplier_id` string

    **Example:** `382411381263052204`
  - `location_id` string

    **Example:** `190035786870033452`
  - `note` string

    **Example:** `testaaa`
  - `state` integer

    **Default value:** `0`

    **Example:** `1`
  - `pending_quantity` integer

    **Default value:** `0`

    **Example:** `0`
  - `received_quantity` integer

    **Default value:** `0`

    **Example:** `0`
  - `rejected_quantity` integer

    **Default value:** `0`

    **Example:** `0`
  - `transfer_quantity` integer

    **Default value:** `0`

    **Example:** `0`
  - `created_by` string

    **Example:**
  - `created_at` string

    **Example:** `2024-05-21T08:47:39Z`
  - `updated_at` string

    **Example:** `2024-05-21T08:50:36Z`

```json
{
  "procurement": {
    "id": "382451985837728044",
    "procurement_sn": "00000002",
    "supplier_id": "382411381263052204",
    "location_id": "190035786870033452",
    "note": "testaaa",
    "state": 1,
    "pending_quantity": 0,
    "received_quantity": 0,
    "rejected_quantity": 0,
    "transfer_quantity": 0,
    "created_by": "",
    "created_at": "2024-05-21T08:47:39Z",
    "updated_at": "2024-05-21T08:50:36Z"
  }
}
```

```json
{
    "procurement": {
        "id": "382451985837728044",
        "procurement_sn": "00000002",
        "supplier_id": "382411381263052204",
        "location_id": "190035786870033452",
        "note": "testaaa",
        "state": 1,
        "pending_quantity": 0,
        "received_quantity": 0,
        "rejected_quantity": 0,
        "transfer_quantity": 0,
        "created_by": "",
        "created_at": "2024-05-21T08:47:39Z",
        "updated_at": "2024-05-21T08:50:36Z"
    }
}
```

400

**application/json**

**Schema | Example | Result**

**Schema**

- `errors` string[]

```json
{
  "errors": [
    "invalid procurement_id"
  ]
}
```

```json
{
  "errors": [
    "invalid procurement_id"
  ]
}
```

404

**application/json**

**Schema | Example | Result**

**Schema**

- `errors` string[]

```json
{
  "errors": [
    "Procurement not found"
  ]
}
```

```json
{
  "errors": [
    "Procurement not found"
  ]
}
```

422

**application/json**

**Schema | Example | Result**

**Schema**

- `errors` string[]

```json
{
  "errors": [
    "Supplier not found"
  ]
}
```

```json
{
  "errors": [
    "Supplier not found"
  ]
}
```
