# Contact

## Get Contacts

<mark style="color:blue;">`GET`</mark> `https://open-api.zortout.com/v4/Contact/GetContacts`

Get list of contacts.

#### Query Parameters

| Name    | Type   | Description                             |
| ------- | ------ | --------------------------------------- |
| keyword | String | Keyword to search at least 3 characters |
| page    | Int    | Page (Default = 1)                      |
| limit   | Int    | Limit per page (Max = 500)              |

#### Headers

| Name                                        | Type   | Description                              |
| ------------------------------------------- | ------ | ---------------------------------------- |
| storename<mark style="color:red;">\*</mark> | String | Store Name                               |
| apikey<mark style="color:red;">\*</mark>    | String | API Key                                  |
| apisecret<mark style="color:red;">\*</mark> | String | API Secret                               |
| contactidlist                               | String | <p>Contact ID List <br>Ex. 1234,5678</p> |

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

<table><thead><tr><th width="183.0455190308588">Parameter</th><th width="157.5770517201441">Type</th><th>Description/Example</th></tr></thead><tbody><tr><td>res</td><td>Response</td><td>Response Code <br>200- Success</td></tr><tr><td>list</td><td>Contact (Array)</td><td>Contact List (Array)</td></tr><tr><td>count</td><td>Int</td><td>Total contact number by filter</td></tr></tbody></table>

<table><thead><tr><th width="162.102472199407">Contact (Array)</th><th width="150">Type</th><th>Description/Example</th></tr></thead><tbody><tr><td>id</td><td>Int</td><td>Contact ID</td></tr><tr><td>name</td><td>String</td><td>Contact Name</td></tr><tr><td>code</td><td>String</td><td>Contact Code</td></tr><tr><td>idnumber</td><td>String</td><td>Contact ID Number/Tax ID</td></tr><tr><td>phone</td><td>String</td><td>Contact Phone</td></tr><tr><td>email</td><td>String</td><td>Contact Email</td></tr><tr><td>address</td><td>String</td><td>Contact Address</td></tr><tr><td>branchname</td><td>String</td><td>Branch Name</td></tr><tr><td>branchno</td><td>String</td><td>Branch No</td></tr><tr><td>facebook</td><td>String</td><td>Facebook</td></tr><tr><td>line</td><td>String</td><td>LINE</td></tr><tr><td>instagram</td><td>String</td><td>Instagram</td></tr><tr><td>imagepath</td><td>String</td><td>Image Url</td></tr><tr><td>tag</td><td>String (Array)</td><td>Tag List (Array)</td></tr><tr><td>properties</td><td>Property (Array)</td><td>Custom Properties List</td></tr></tbody></table>

| Property (Array) | Type   | Description/Example |
| ---------------- | ------ | ------------------- |
| id               | Int    | Property ID         |
| name             | String | Property Name       |
| value            | String | Property Value      |
| {% endtab %}     |        |                     |
| {% endtabs %}    |        |                     |

## Get Contact Detail

<mark style="color:blue;">`GET`</mark> `https://open-api.zortout.com/v4/Contact/GetContactDetail`

Get contact detail

#### Query Parameters

| Name                                 | Type | Description |
| ------------------------------------ | ---- | ----------- |
| id<mark style="color:red;">\*</mark> | Int  | Contact ID  |

#### Headers

| Name                                        | Type   | Description |
| ------------------------------------------- | ------ | ----------- |
| storename<mark style="color:red;">\*</mark> | String | Store Name  |
| apikey<mark style="color:red;">\*</mark>    | String | API Key     |
| apisecret<mark style="color:red;">\*</mark> | String | API Secret  |

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

<table><thead><tr><th width="150">Parameter</th><th>Type</th><th>Description/Example</th></tr></thead><tbody><tr><td>id</td><td>Int</td><td>Contact ID</td></tr><tr><td>name</td><td>String</td><td>Contact Name</td></tr><tr><td>code</td><td>String</td><td>Contact Code</td></tr><tr><td>idnumber</td><td>String</td><td>Contact ID Number/Tax ID</td></tr><tr><td>phone</td><td>String</td><td>Contact Phone</td></tr><tr><td>email</td><td>String</td><td>Contact Email</td></tr><tr><td>address</td><td>String</td><td>Contact Address</td></tr><tr><td>branchname</td><td>String</td><td>Branch Name</td></tr><tr><td>branchno</td><td>String</td><td>Branch No</td></tr><tr><td>facebook</td><td>String</td><td>Facebook</td></tr><tr><td>line</td><td>String</td><td>LINE</td></tr><tr><td>instagram</td><td>String</td><td>Instagram</td></tr><tr><td>imagepath</td><td>String</td><td>Image Url</td></tr><tr><td>subContactList</td><td>SubContact (Array)</td><td>Subcontact List (Array)</td></tr><tr><td>shippingList</td><td>ShippingAddress (Array)</td><td>Shipping Address List (Array)</td></tr><tr><td>tag</td><td>String (Array)</td><td>Tag List (Array)</td></tr><tr><td>properties</td><td>Property (Array)</td><td>Custom Properties List</td></tr></tbody></table>

<table><thead><tr><th width="202.16370106761565">SubContact (Array)</th><th width="150">Type</th><th>Description/Example</th></tr></thead><tbody><tr><td>name</td><td>String</td><td>Subcontact Name</td></tr><tr><td>position</td><td>String</td><td>Subcontact Position</td></tr><tr><td>phone</td><td>String</td><td>Subcontact Phone</td></tr><tr><td>mobile</td><td>String</td><td>Subcontact Mobile</td></tr><tr><td>email</td><td>String</td><td>Subcontact Email</td></tr><tr><td>isMain</td><td>Boolean</td><td>Main Status</td></tr></tbody></table>

<table><thead><tr><th>ShippingAddress (Array)</th><th width="150">Type</th><th>Description/Example</th></tr></thead><tbody><tr><td>name</td><td>String</td><td>Shipping Name</td></tr><tr><td>address</td><td>String</td><td>Shipping Address</td></tr><tr><td>phone</td><td>String</td><td>Shipping Phone</td></tr><tr><td>email</td><td>String</td><td>Shipping Email</td></tr><tr><td>isMain</td><td>Boolean</td><td>Main Status</td></tr></tbody></table>

| Property (Array) | Type   | Description/Example |
| ---------------- | ------ | ------------------- |
| id               | Int    | Property ID         |
| name             | String | Property Name       |
| value            | String | Property Value      |
| {% endtab %}     |        |                     |
| {% endtabs %}    |        |                     |

## Add Contact

<mark style="color:green;">`POST`</mark> `https://open-api.zortout.com/v4/Contact/AddContact`

Add contact.

#### Headers

| Name                                        | Type   | Description |
| ------------------------------------------- | ------ | ----------- |
| storename<mark style="color:red;">\*</mark> | String | Store Name  |
| apikey<mark style="color:red;">\*</mark>    | String | API Key     |
| apisecret<mark style="color:red;">\*</mark> | String | API Secret  |

#### Request Body

| Name                                   | Type             | Description                                                                        |
| -------------------------------------- | ---------------- | ---------------------------------------------------------------------------------- |
| code<mark style="color:red;">\*</mark> | String           | Contact Code                                                                       |
| name<mark style="color:red;">\*</mark> | String           | Contact Name                                                                       |
| idnumber                               | String           | Contact ID Number/Tax ID                                                           |
| phone                                  | String           | Contact Phone                                                                      |
| email                                  | String           | Contact Email                                                                      |
| address                                | String           | Contact Address                                                                    |
| branchname                             | String           | Branch Name                                                                        |
| branchno                               | String           | Branch No                                                                          |
| facebook                               | String           | Facebook                                                                           |
| line                                   | String           | Line                                                                               |
| instagram                              | String           | Instagram                                                                          |
| ∟ value                                | String           | Property Value                                                                     |
| ∟ name                                 | String           | <p>Property Name Require if id = 0 or null</p><p>\*Must have either id or name</p> |
| ∟ id                                   | Int              | <p>Property ID</p><p>\*Must have either id or name</p>                             |
| properties                             | Property (Array) | Custom Properties List                                                             |

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

<table><thead><tr><th width="245.48063250061637">Parameter</th><th width="153.33333333333331">Type</th><th>Description/Example</th></tr></thead><tbody><tr><td>resCode</td><td>String</td><td>Response Code <br>200- Succes</td></tr><tr><td>resDesc</td><td>String</td><td>Response Description</td></tr><tr><td>detail</td><td>Detail</td><td>Detail</td></tr></tbody></table>

| Detail       | Type | Description/Example |
| ------------ | ---- | ------------------- |
| id           | Int  | Contact ID          |
| {% endtab %} |      |                     |

{% tab title="Ex. Request JSON" %}

```json
{
  "code": "C0001",
  "name": "Contact1",
  "idnumber": "123456789",
  "email": "testemail@zortout.com",
  "phone": "021234567"
}
```

{% endtab %}
{% endtabs %}

## Update Contact

<mark style="color:green;">`POST`</mark> `https://open-api.zortout.com/v4/Contact/UpdateContact`

Edit contact info

#### Query Parameters

| Name                                 | Type | Description |
| ------------------------------------ | ---- | ----------- |
| id<mark style="color:red;">\*</mark> | Int  | Contact ID  |

#### Headers

| Name                                        | Type   | Description |
| ------------------------------------------- | ------ | ----------- |
| storename<mark style="color:red;">\*</mark> | String | Store Name  |
| apikey<mark style="color:red;">\*</mark>    | String | API Key     |
| apisecret<mark style="color:red;">\*</mark> | String | API Secret  |

#### Request Body

| Name                                   | Type   | Description              |
| -------------------------------------- | ------ | ------------------------ |
| idnumber                               | String | Contact ID Number/Tax ID |
| code<mark style="color:red;">\*</mark> | String | Contact Code             |
| facebook                               | String | Facebook                 |
| name                                   | String | Contact Name             |
| branchname                             | String | Branch Name              |
| line                                   | String | Line                     |
| address                                | String | Contact Address          |
| phone                                  | String | Contact Phone            |
| email                                  | String | Contact Email            |
| instagram                              | String | Instagram                |
| branchno                               | String | Branch No                |

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

| Parameter    | Type   | Description/Example                   |
| ------------ | ------ | ------------------------------------- |
| resCode      | String | <p>Response Code <br>200- Success</p> |
| resDesc      | String | Response Description                  |
| {% endtab %} |        |                                       |

{% tab title="Ex. Request JSON" %}

```json
{
  "code": "C0001",
  "name": "Contact1",
  "idnumber": "123456789",
  "email": "testemail@zortout.com",
  "phone": "021234567"
}
```

{% endtab %}
{% endtabs %}
