# 사용자 일괄 동기화(추가/수정/삭제)

<mark style="background-color:green;">POST</mark> `https://openapi.exosp.com/organization/v1/member/sync-batch`

사용자 정보를 일괄 동기화하는 API 입니다.

* 추가(Create)&#x20;
  * 보내준 항목의 식별자가 없거나, 서버에서 찾을 수 없으면 새 항목을 만들어 넣습니다.
* 수정(Update)&#x20;
  * 보내준 항목의 식별자(id 등)가 서버에 이미 있으면, 그 항목의 값을 최신 내용으로 바꿉니다.
* 삭제(Delete)
  * 서버에는 있는데 이번 요청 목록에 포함되지 않은 항목은 더 이상 필요하지 않은 것으로 보고 삭제합니다.

### Request Body <a href="#query-parameters" id="query-parameters"></a>

| 항목                                                     | 타입     | 설명                                   |
| ------------------------------------------------------ | ------ | ------------------------------------ |
| memberList<mark style="color:red;">\*</mark>           | array  | [#memberlist](#memberlist "mention") |
| sendInstallationMail<mark style="color:red;">\*</mark> | string | **설치 메일 발송 여부(Y/N)**                 |

#### MemberList

| 항목                                               | 타입     | 설명                                            |
| ------------------------------------------------ | ------ | --------------------------------------------- |
| name<mark style="color:red;">\*</mark>           | string | **사용자 이름**                                    |
| email<mark style="color:red;">\*</mark>          | string | **사용자 메일**                                    |
| departmentFull<mark style="color:red;">\*</mark> | string | **그룹 전체 경로**                                  |
| isNotEmailTypeValid                              | string | **아이디에 대한 이메일 형태 체크여부**(Y: 유효성 체크함, N: 체크 안함) |

### Response Schema

<table><thead><tr><th width="162">항목</th><th width="115">타입</th><th>설명</th></tr></thead><tbody><tr><td>code</td><td>int</td><td><p><strong>응답 처리 결과 코드</strong> </p><p>0 : 성공, 1 : 실패</p></td></tr><tr><td>message</td><td>string</td><td><p><strong>응답 처리 결과 메세지</strong></p><p>success : 성공, 그 외 : 실패</p></td></tr><tr><td>body</td><td>object</td><td><a data-mention href="#body">#body</a></td></tr></tbody></table>

#### **body 상세**

<table><thead><tr><th width="183.2265625">항목</th><th width="115">타입</th><th>설명</th></tr></thead><tbody><tr><td>summary</td><td>array</td><td><a data-mention href="#summary">#summary</a></td></tr><tr><td>insertMemberDetail</td><td>array</td><td><a data-mention href="#member">#member</a></td></tr><tr><td>updateMemberDetail</td><td>array</td><td><a data-mention href="#member">#member</a></td></tr><tr><td>deleteMemberDetail</td><td>array</td><td><a data-mention href="#member">#member</a></td></tr></tbody></table>

#### summary 상세

<table><thead><tr><th width="196.63671875">항목</th><th width="110">타입</th><th>설명</th></tr></thead><tbody><tr><td>totalMember</td><td>int</td><td><strong>총 사용자 수</strong></td></tr><tr><td>originMember</td><td>int</td><td><strong>기존 사용자 수</strong></td></tr><tr><td>insertMember</td><td>int</td><td><strong>추가 사용자 수</strong></td></tr><tr><td>updateMember</td><td>int</td><td><strong>수정 사용자 수</strong></td></tr><tr><td>deleteMember</td><td>int</td><td><strong>삭제 사용자 수</strong> </td></tr></tbody></table>

#### member 상세

<table><thead><tr><th width="181">항목</th><th width="110">타입</th><th>설명</th></tr></thead><tbody><tr><td>email</td><td>string</td><td><strong>사용자 메일</strong></td></tr><tr><td>success</td><td>string</td><td><strong>성공 여부</strong></td></tr><tr><td>message</td><td>string</td><td><strong>오류 메세지</strong></td></tr></tbody></table>

### Example

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

```javascript
curl -X 'POST' \
  'https://openapi.exosp.com/organization/v1/member' \
  -H 'accept: application/json' \
  -H 'x-exosp-access: YOUR_ACCESS_KEY' \
  -H 'x-exosp-secret: YOUR_ACCESS_SECRET' 
  -d '{
  "memberList": [
    {
      "name": "ysmoon",
      "email": "ysmoon@exosp.com",
      "departmentFull": "dev-ys",
      "isNotEmailTypeValid": "N"
    },
    {
      "name": "test",
      "email": "test@exosp.com",
      "departmentFull": "dev-ys",
      "isNotEmailTypeValid": "N"
    }
  ],
  "sendInstallationMail": "N"
}'
 
{
  "code": 0,
  "message": "success",
  "body": {
    "summary": {
      "totalMember": 2,
      "originMember": 2,
      "insertMember": 1,
      "updateMember": 0,
      "deleteMember": 0
    },
    "insertMemberDetail": [
      {
        "email": "test@exosp.com",
        "name": "test",
        "success": true
      }
    ],
    "updateMemberDetail": [],
    "deleteMemberDetail": [
      {
        "email": "user11@exosp.com",
        "success": false,
        "error": "Cannot delete member with manager role"
      }
    ]
  }
}
```

{% endtab %}

{% tab title="Untitled" %}

{% endtab %}
{% endtabs %}


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://openapi-docs.exosp.com/guide/organization/member-sync-batch.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
