> For the complete documentation index, see [llms.txt](https://crmx-support.gitbook.io/crmx-api-document/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://crmx-support.gitbook.io/crmx-api-document/master.md).

# Member API

## Lấy thông tin thành viên

<mark style="color:blue;">`GET`</mark> `{{base_url}}/customers_location`

Cho phép lấy thông tin thành viên của một địa điểm (shop, cửa hàng, nhà hàng...) theo số điện thoại.

#### Query Parameters

| Name    | Type   | Description   |
| ------- | ------ | ------------- |
| phone   | string | số điện thoại |
| pos\_id | string | id địa điểm   |

#### Headers

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

{% tabs %}
{% tab title="200 Lấy thành công thông tin địa điểm" %}

```javascript
{
    "status": 200,
    "message": "Customer info",
    "data": {
        "_id": "5d8c353a7c857b43b4eff3ae",
        "age_range": null,
        "year_birthday": "1996",
        "home_town": "Ha Noi",
        "twitter": null,
        "gender": "1",
        "created_at": "26-09-2019",
        "fb_id": "152134088",
        "phone": "0945350398",
        "birthday": "05-30",
        "facebook": "https://www.facebook.com/CRMX.com.vn/",
        "address": "Phao Dai Lang",
        "relationship_status": "Chua ket hon",
        "client_mac": [],
        "email": "phundk59uet@gmail.com",
        "name": "Ly Tu Quang Thang",
        "updated_at": "26-09-2019"
}
```

{% endtab %}

{% tab title="401 " %}

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

{% endtab %}

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

```javascript
{
    "status": 404,
    "status_code": 404,
    "message": "Customer not found!"
}
```

{% endtab %}
{% endtabs %}

## Tạo mới thành viên

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

Cho phép tạo mới thành viên vào một địa điểm

#### Query Parameters

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

#### Headers

| Name          | Type   | Description             |
| ------------- | ------ | ----------------------- |
| Content-Type  | string | application/json        |
| Authorization | string | Bearer \<access\_token> |

#### Request Body

| Name                 | Type   | Description               |
| -------------------- | ------ | ------------------------- |
| name                 | string | Họ và tên                 |
| phone                | string | Số điện thoại             |
| email                | string | Email                     |
| gender               | string | Giới tính (nam: 1, nữ: 2) |
| relationship\_status | string | Trạng thái hôn nhân       |
| birthday             | string | Sinh nhật (mm-dd)         |
| year\_birthday       | string | Năm sinh                  |
| home\_town           | string | Quê quán                  |
| address              | string | Địa chỉ                   |
| fb\_id               | string | id facebook               |
| facebook             | string | Link facebook cá nhân     |
| twitter              | string | Link twitter cá nhân      |

{% tabs %}
{% tab title="200 Tạo mới thành công" %}

```
{
    "status": 200,
    "status_code": 200,
    "message": "Success!"
}
```

{% endtab %}

{% tab title="400 Sai dữ liệu truyền vào " %}

```
{
    "status": 400,
    "status_code": 400,
    "message": "Wrong data!"
}
```

{% endtab %}

{% tab title="401 access\_token không tồn tại " %}

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

{% endtab %}

{% tab title="404 pos\_id không tồn tại" %}

```
{
    "status": 404,
    "status_code": 404,
    "message": "pos_id does not exist!"
}
```

{% endtab %}

{% tab title="409 Thành viên đã tồn tại" %}

```
{
    "status": 409,
    "status_code": 409,
    "message": "Customer already exist!"
}
```

{% endtab %}
{% endtabs %}

## Thay đổi thông tin thành viên

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

Cho phép tạo mới thành viên vào một địa điểm

#### Query Parameters

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

#### Headers

| Name          | Type   | Description             |
| ------------- | ------ | ----------------------- |
| Content-Type  | string | application/json        |
| Authorization | string | Bearer \<access\_token> |

#### Request Body

| Name                 | Type   | Description               |
| -------------------- | ------ | ------------------------- |
| name                 | string | Họ và tên                 |
| phone                | string | Số điện thoại             |
| email                | string | Email                     |
| gender               | string | Giới tính (nam: 1, nữ: 2) |
| relationship\_status | string | Trạng thái hôn nhân       |
| birthday             | string | Sinh nhật (mm-dd)         |
| year\_birthday       | string | Năm sinh                  |
| home\_town           | string | Quê quán                  |
| address              | string | Địa chỉ                   |
| fb\_id               | string | id facebook               |
| facebook             | string | Link facebook cá nhân     |
| twitter              | string | Link twitter cá nhân      |

{% tabs %}
{% tab title="200 Thanh đổi thông tin khách hàng thành công" %}

```
{
    "status": 200,
    "status_code": 200,
    "message": "Success!"
}
```

{% endtab %}

{% tab title="400 Sai dữ liệu truyền vào " %}

```
{
    "status": 400,
    "status_code": 400,
    "message": "Wrong data!"
}
```

{% endtab %}

{% tab title="401 access\_token không tồn tại " %}

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

{% endtab %}

{% tab title="404 pos\_id không tồn tại" %}

```
{
    "status": 404,
    "status_code": 404,
    "message": "Customer not found! Please create new customer!"
}
```

{% endtab %}
{% endtabs %}
