> For the complete documentation index, see [llms.txt](https://baeminchan-project.gitbook.io/project/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://baeminchan-project.gitbook.io/project/undefined-1/item-1.md).

# 장바구니 item 추가

<mark style="color:green;">`POST`</mark> `https://api.elegantsiblings.xyz/cart/`

This endpoint allows you to get free cakes.

#### Headers

| Name          | Type   | Description        |
| ------------- | ------ | ------------------ |
| Authorization | string | Token \<token key> |

#### Request Body

| Name     | Type    | Description |
| -------- | ------- | ----------- |
| item\_pk | integer | 추가할 반찬의 pk  |
| amount   | integer | 추가할 수       |

{% tabs %}
{% tab title="201 user의 전체 장바구니가 보인다" %}

```javascript
[
    {
        "cart_item_pk": "5",
        "user": {
            "user_pk": "1",
            "username": "lee",
            "first_name": "test",
            "last_name": "",
            "email": "",
            "img_profile": null
        },
        "item": {
            "item_pk": "2",
            "company": "집밥의완성",
            "item_name": "고깃집 그 참기름 묵은지무침 (1~2인분) 200g",
            "origin_price": 3300,
            "sale_price": 2450,
            "discount_rate": 0.25,
            "list_thumbnail": "https://wps-9th-chajeehyung-practice.s3.amazonaws.com/media/Item/cat7.jpg?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=AKIAIG4DIK7WJ5QD5WAA%2F20181205%2Fap-northeast-2%2Fs3%2Faws4_request&X-Amz-Date=20181205T105013Z&X-Amz-Expires=3600&X-Amz-SignedHeaders=host&X-Amz-Signature=b768ea4657dda38f97bc6f2b476829fe20ade774b51918125c00050f17099c00"
        },
        "amount": 2
    },
    {
        "cart_item_pk": "8",
        "user": {
            "user_pk": "1",
            "username": "lee",
            "first_name": "test",
            "last_name": "",
            "email": "",
            "img_profile": null
        },
        "item": {
            "item_pk": "4",
            "company": "진가네반찬",
            "item_name": "묵나물볶음 (2~3인분) 150g",
            "origin_price": 5000,
            "sale_price": 5000,
            "discount_rate": 0,
            "list_thumbnail": null
        },
        "amount": 3
    }
]
```

{% endtab %}

{% tab title="400 Could not find a cake matching this query." %}

```javascript
1. 이미 있는 반찬을 추가할 
{
    "error": "이미 장바구니에 있는 item입니다. patch를 이용해주세요"
}
```

{% endtab %}

{% tab title="401 " %}

```
1. token이 없는 경
{
    "detail": "자격 인증데이터(authentication credentials)가 제공되지 않았습니다."
}
2. token이 이상한 경우
{
    "detail": "토큰이 유효하지 않습니다."
}
```

{% endtab %}

{% tab title="404 item이 없을 때 " %}

```
{
    "error": "존재하지 않는 item입니다"
}
```

{% endtab %}
{% endtabs %}
