# Location API

## Tạo mới địa điểm

<mark style="color:green;">`POST`</mark> `{{base_url}}/create_location`

Cho phép tạo mới một địa điểm

#### Query Parameters

| Name              | Type   | Description                                     |
| ----------------- | ------ | ----------------------------------------------- |
| merchant\_id\_app | string | id chuỗi ( setting trong crm.crmx.com.vn/apps ) |
| pos\_id           | string | id địa điểm                                     |
| method            | string | "add"                                           |

#### Headers

| Name          | Type   | Description             |
| ------------- | ------ | ----------------------- |
| Authorization | string | Bearer \<access\_token> |
| Content-Type  | string | multipart/form-data     |

#### Request Body

| Name                          | Type   | Description                |
| ----------------------------- | ------ | -------------------------- |
| name                          | string | tên địa điểm               |
| google\_pixel\_code           | string | code pixel google          |
| connect\_button               | string | text nút kết nối           |
| welcome\_member\_text\_splash | string | lời chào trang mặc định    |
| page\_id                      | string | ID page                    |
| facebook\_pixel\_id           | string | ID facebook pixel          |
| facebook\_pixel\_code         | string | code facebook pixel        |
| ignore\_resgister             | string | bỏ qua yêu cầu đăng ký     |
| wifi\_access\_code            | string | code access wifi           |
| user\_otp\_required           | string | yêu cầu bắt buộc otp user  |
| user\_otp                     | string | sử dụng mã otp             |
| facebook\_page                | string | Facebook page              |
| zalo\_oa\_id                  | string | zalo oa ID                 |
| zalo\_oa\_key                 | string | Zalo oa key                |
| date\_start\_contract         | string | Ngày bắt đầu hợp đồng      |
| date\_end\_contract           | string | Ngày kết thúc hợp đồng     |
| auto\_popup                   | string | Chuyển hướng sau đăng nhập |
| logo                          | string | ảnh logo                   |
| background                    | string | ảnh nền                    |
| phone                         | string | số điện thoại              |
| email                         | string | email                      |
| website                       | string | website trang chủ          |
| hotline                       | string | số hotline                 |
| address                       | string | địa chỉ                    |

{% tabs %}
{% tab title="200 Cake successfully retrieved." %}

```javascript
{
    "status": 200,
    "message": "success!",
    "data": {
        "_id": "5d9dfab67c0268d2439de2a5",
        "pos_id": "578965",
        "name": "chuong123test",
        "email_template": {
            "announcement": {},
            "return": {},
            "lost": {},
            "happy_birthday": {},
            "welcome": {},
            "loyal": {}
        },
        "sms": {
            "announcement": {},
            "return": {},
            "lost": {},
            "happy_birthday": {},
            "welcome": {},
            "loyal": {}
        },
        "splash_lang": "vi",
        "phone": "0396804012",
        "background": "7f7e2b3dd5307666bc68a075b97c6fcf.jpeg",
        "welcome_member_text_splash": null,
        "logo": "7f7e2b3dd5307666bc68a075b97c6fcf.jpeg",
        "merchant_id": "5a616f383fd79c2db9147c6a",
        "slug": "chuong123test"
    }
}
```

{% endtab %}

{% tab title="401 " %}

```
{
    "status_code": "401",
    "message": "access_token not found! Please contact CRMX at support@crmx.com.vn for help"
}
```

{% endtab %}
{% endtabs %}

## Update địa điểm

<mark style="color:orange;">`PUT`</mark> `{{base_url}}/create_location`

Cho phép update địa điểm

#### Query Parameters

| Name    | Type   | Description |
| ------- | ------ | ----------- |
| pos\_id | string | id địa điểm |

#### Headers

| Name          | Type   | Description             |
| ------------- | ------ | ----------------------- |
| Authorization | string | Bearer \<access\_token> |

#### Request Body

| Name                          | Type   | Description                    |
| ----------------------------- | ------ | ------------------------------ |
| name                          | string | tên địa điểm                   |
| background                    | string | ảnh nền                        |
| logo                          | string | ảnh logo                       |
| phone                         | string | số điện thoại                  |
| email                         | string | email                          |
| website                       | string | website công ty                |
| hotline                       | string | số hotline                     |
| address                       | string | địa chỉ                        |
| facebook\_page                | string | trang facebook địa điểm        |
| zalo\_oa\_id                  | string | zalo oa id                     |
| zalo\_oa\_key                 | string | zalo oa key                    |
| date\_start\_contract         | string | Ngày bắt đầu hợp đồng          |
| date\_end\_contract           | string | Ngày kết thúc hợp đồng         |
| auto\_popup                   | string | Trang chuyển hướng khi kết nối |
| ignore\_register              | string |                                |
| wifi\_access\_code            | string |                                |
| use\_otp\_required            | string | yêu cầu bắt buộc otp           |
| connect\_button               | string | text nút kết nối               |
| welcome\_member\_text\_splash | string | lời chào trang mặc định        |
| page\_id                      | string | id page                        |
| facebook\_pixel\_id           | string | id facebook pixel              |
| facebook\_pixel\_code         | string | code pixel facebook            |
| google\_pixel\_code           | string | code pixel Google             |

{% tabs %}
{% tab title="200 " %}

```
```

{% endtab %}
{% endtabs %}
