> For the complete documentation index, see [llms.txt](https://shiply-integration-apis.gitbook.io/shiply-integration-documentation/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://shiply-integration-apis.gitbook.io/shiply-integration-documentation/integration-apis/parcel-content/update-parcel-content.md).

# Update Parcel Content

```php
POST /parcel-content/update/{id}
```

This API is used to modify the information of existing parcel content.

{% hint style="info" %}
**Note:** Replace <mark style="color:blue;">{id}</mark> with the id of the parcel content whose information you want to update.
{% endhint %}

#### Headers

<table><thead><tr><th width="374">Key</th><th>Value</th></tr></thead><tbody><tr><td>Accept</td><td>application/json</td></tr><tr><td>Content-Type</td><td>multipart/form-data</td></tr></tbody></table>

#### Request body

Request parameters:

<table><thead><tr><th width="247">Field Name</th><th width="106">Required</th><th width="93">Type</th><th>Notes</th></tr></thead><tbody><tr><td>companion_parcel_id</td><td>no</td><td>integer</td><td>If you want to add content to a companion parcel.</td></tr><tr><td>product_id</td><td>no</td><td>integer</td><td></td></tr><tr><td>item_name</td><td>no</td><td>string</td><td>Only when no <mark style="color:blue;">product_id</mark> is passed.</td></tr><tr><td>description</td><td>no</td><td>string</td><td>Maximum of 255 characters. </td></tr><tr><td>item_price</td><td>no</td><td>numeric</td><td></td></tr><tr><td>quantity</td><td>no</td><td>numeric</td><td></td></tr><tr><td>item_image</td><td>no</td><td>image</td><td>Allowed extensions: png, jpeg, webp, jpg and maximum image size is 2 MB.</td></tr><tr><td>content_photo</td><td>no</td><td>image</td><td>Allowed extensions: png, jpeg, webp, jpg and maximum image size is 2 MB.</td></tr></tbody></table>

{% hint style="info" %}
The request body should be sent in form-data format.
{% endhint %}

#### Response body

{% tabs %}
{% tab title="Success" %}
Status code: <mark style="color:green;">200 OK</mark>

{% code lineNumbers="true" %}

```json
{
    "parcel_content": {
        "id": 9,
        "parcel_id": 1312393,
        "companion_parcel_id": null,
        "product_id": null,
        "item_name": "testtt1",
        "description": "description",
        "item_price": null,
        "quantity": "1.00",
        "item_image": null,
        "content_photo": null,
        "created_at": "2024-12-19 14:10:12",
        "updated_at": "2024-12-19 14:16:13",
        "attachments": []
    }
}
```

{% endcode %}

The response includes a <mark style="color:blue;">parcel\_content</mark> field, which contains the updated details of the parcel content.
{% endtab %}

{% tab title="Product not found" %}
Status code: <mark style="color:red;">404 not found</mark>

{% code lineNumbers="true" %}

```json
{
    "success": false,
    "error": "product not found"
}
```

{% endcode %}

This response is returned when the <mark style="color:blue;">product\_id</mark> provided in the request body (if provided) does not correspond to an existing product in the product catalog.
{% endtab %}

{% tab title="Parcel content not found" %}
Status code: <mark style="color:red;">404 not found</mark>

{% code lineNumbers="true" %}

```json
{
    "success": false,
    "error": "parcel content not found"
}
```

{% endcode %}

This response is returned when the <mark style="color:blue;">{id}</mark> provided in the route not belongs to a created parcel content.
{% endtab %}

{% tab title="Companion parcel not found" %}
Status code: <mark style="color:red;">404 not found</mark>

{% code lineNumbers="true" %}

```json
{
    "success": false,
    "error": "companion parcel not found"
}
```

{% endcode %}

This response is returned when the <mark style="color:blue;">companion\_parcel\_id</mark> provided in the request (if provided) body not belongs to a created companion parcel.
{% endtab %}

{% tab title="Cannot edit content" %}
Status code: <mark style="color:red;">403 unauthorized</mark>

{% code lineNumbers="true" %}

```json
{
    "success": false,
    "error": "you cannot edit content for non draft or submitted parcel"
}
```

{% endcode %}

This response is returned when the <mark style="color:blue;">{id}</mark> provided in the route corresponds to a parcel content, and the associated parcel is neither in draft nor submitted status.
{% endtab %}

{% tab title="Fail" %}
Status code: <mark style="color:red;">500</mark>

{% code lineNumbers="true" %}

```json
{
    "success": false,
    "error": "failed to update parcel content"
}
```

{% endcode %}

This response is returned when a database error occurs while attempting to update a parcel content.
{% endtab %}

{% tab title="Unauthorized" %}
Status code: <mark style="color:green;">200 OK</mark>

{% code lineNumbers="true" %}

```json
{
    "success": false,
    "errors": [
        "unauthorized"
    ]
}
```

{% endcode %}

This response is returned when the <mark style="color:blue;">Shiply\_API\_KEY</mark> is not included in the request body.
{% endtab %}
{% endtabs %}
