# 레이아웃 등록

## Request

## 브랜드 내에서 사용할 수 있는 레이아웃을 등록 합니다.  <br>

> 브랜드 내에서 사용할 수 있는 레이아웃을 등록 합니다.  \
> \
> &#x20; \+ \*\*계정 권한: 대행사\*\*  \
> &#x20; \+ \*\*브랜드 권한: 운영자\*\*<br>

```json
{"openapi":"3.0.0","info":{"title":"RCS Biz Center API 규격","version":"1.1.12"},"servers":[{"description":"RCS Biz Center API for Staging","url":"https://api-qa.rcsbizcenter.com/api/1.1"},{"description":"RCS Biz Center API for Production","url":"https://api.rcsbizcenter.com/api/1.1"}],"security":[{"jwtAuth":[]}],"components":{"securitySchemes":{"jwtAuth":{"type":"http","scheme":"bearer","bearerFormat":"JWT","description":"인증방식은 JWT인증을 사용합니다. 토큰의 갱신은 없으며 토큰 만료 시 항상 재발급 받아야 합니다.\n"}},"parameters":{"BrandKey":{"name":"X-RCS-Brandkey","in":"header","schema":{"type":"string","maxLength":18},"description":"maxLength: 18 - RCS Biz Center에서 브랜드 등록 시 자동 생성되는 Key 입니다.  \n\n대행사가 해당 브랜드에 대한 권한 여부를 판단하는데 사용됩니다.\n따라서, 대행사 계정으로 브랜드 내 정보를 조회/등록/수정 API 연동 시 Header에 설정되어야 합니다.\n"},"BrandId":{"name":"brandId","in":"path","schema":{"type":"string","maxLength":13},"required":true,"description":"maxLength: 13 - 브랜드 내 정보 접근시 사용되는 브랜드ID Path Parameter 입니다.\n"}},"schemas":{"RegBrandLayout":{"type":"object","description":"레이아웃 등록 객체 정보 입니다.\n","properties":{"layoutName":{"type":"string","description":"maxLength: 40 - 레이아웃 이름을 지정합니다.\n","maxLength":40},"productCode":{"type":"string","description":"maxLength: 20 - 레이아웃의 메시지 상품 코드 입니다.\n","maxLength":20,"enum":["sms","lms","mms"]},"sampleLayoutId":{"type":"string","description":"maxLength: 40 - 샘플 레이아웃 ID 입니다.\n샘플 레이아웃을 이용하여 부분적으로 컴포넌트 변경하여 등록하는 경우 설정합니다.\n","maxLength":40},"headerComposition":{"type":"array","description":"카드 내의 최상위 영역으로 1개의 컴포넌트를 지정할 수 있습니다.  \n컴포넌트 중 headerYn = 'Y' 인 컴포넌트만 등록이 가능합니다.  \n컴포넌트를 지정하지 않을 경우 빈 배열로 등록 합니다.  \n","items":{"$ref":"#/components/schemas/LayoutComponent"}},"bodyComposition":{"type":"array","description":"카드 내의 중간 영역으로 메시지 상품에서 지정한 개수의 컴포넌트를 지정할 수 있습니다.  \n\n컴포넌트 중 bodyYn = 'Y' 인 컴포넌트만 등록이 가능합니다.  \n\n예를 들어 LMS는 최대 6개의 컴포넌트를 지정할 수 있으며, 최대 개수 범위 내에서 각 영역별 배분할 수 있습니다.     \n  \n  + Header 1개 지정 시 body 최대 5개  \n  + body만 지정 시 최대 6개\n","items":{"$ref":"#/components/schemas/LayoutComponent"}},"footerComposition":{"type":"array","description":"카드 내의 최하단 영역으로 1개의 컴포넌트를 지정할 수 있습니다.  \n\n컴포넌트 중 footerYn = 'Y' 인 컴포넌트만 등록이 가능합니다.  \n\n컴포넌트를 지정하지 않을 경우 빈 배열로 등록 합니다.  \n\n현재는 footer에 사용자가 직접 지정하는 컴포넌트는 없습니다.\n","items":{"$ref":"#/components/schemas/LayoutComponent"}}},"required":["layoutName","productCode","headerComposition","bodyComposition","footerComposition"]},"LayoutComponent":{"description":"레이아웃 내 사용되는 컴포넌트 객체입니다.","type":"object","properties":{"index":{"type":"integer","description":"레이아웃 내 컴포넌트의 순번을 표시합니다.  \n등록 시에는 index를 지정하지 않으며, 배열 내 순서를 기준으로 처리됩니다.  \n"},"componentId":{"type":"string","description":"maxLength: 40 - 지정할 컴포넌트 ID 입니다.\n","maxLength":40},"options":{"type":"object","description":"레이아웃 사용 시 컴포넌트에 적용될 수 있는 옵션입니다.   옵션 지정이 가능한 경우 표기됩니다.\n","oneOf":[{"$ref":"#/components/schemas/TableOption"},{"$ref":"#/components/schemas/ButtonOption"},{"$ref":"#/components/schemas/ViewAllOption"}]}},"required":["componentId"]},"TableOption":{"type":"object","description":"Table / StyleTable등 테이블 컴포넌트의 옵션 정보 객체 입니다.  \n","properties":{"leftAlign":{"type":"string","description":"좌측 컬럼(열) 전체의 글자 정렬 위치를 설정합니다.  \n\n  + left : 좌측 정렬  \n  + right : 우측 정렬  \n  + center : 중앙 정렬\n","enum":["left","right","center"],"default":"left"},"rightAlign":{"type":"string","description":"우측 컬럼(열) 전체의 글자 정렬 위치를 설정합니다.  \n\n  + left : 좌측 정렬  \n  + right : 우측 정렬  \n  + center : 중앙 정렬\n","enum":["left","right","center"],"default":"right"},"leftTextStyle":{"type":"string","description":"좌측 컬럼(열)에 입력되는 글자 스타일을 지정합니다.  \n\n  + normal : 기본 스타일\n  + bold : bold 스타일 적용\n","enum":["normal","bold"],"default":"normal"},"rightTextStyle":{"type":"string","description":"우측 컬럼(열)에 입력되는 글자 스타일을 지정합니다.  \n\n  + normal : 기본 스타일\n  + bold : bold 스타일 적용\n","enum":["normal","bold"],"default":"normal"},"maxCount":{"type":"integer","description":"테이블의 행 개수를 지정합니다. 정의된 숫자 이외에는 지정할 수 없습니다.  \n\n  + 5 : 5행\n  + 10 : 10행\n","enum":[5,10],"default":5}}},"ButtonOption":{"type":"object","description":"VButton / HButton 등 버튼 컴포넌트의 옵션 정보 객체 입니다.  \n","properties":{"color":{"type":"string","description":"버튼의 색상 설정 옵션입니다.  \n\n버튼의 색상은 브랜드 정보에서 지정한 templateColor 컬러 Hex 값과 동일해야 합니다.  \n\n빈값 지정 시 기본 버튼 컬러로 적용되며, 지정된 컬러 Hex 값이 templateColor의 값과 다르면 templateColor로 강제 설정됩니다.  \n"}}},"ViewAllOption":{"type":"object","description":"모두보기(viewAll) 옵션 정보 객체 입니다. \n\n컴포넌트 조회 시 options 상에 해당 옵션 설정이 포함되어 있을 때만 유효합니다. \n","properties":{"ctrlViewAll":{"type":"boolean","default":true,"description":"컴포넌트 단위의 viewAll(모두보기) 활성화 여부를 지정합니다. \n\n* true: 컴포넌트 viewAll(모두보기) 활성화 \n* false: 컴포넌트 viewAll(모두보기) 비활성화\n\n> ※ viewAll은 메시지 내 문자열이 표시되는 영역에 설정된 글자수 이상이 입력된 경우, 대상 영역을 '모두보기 >' 표시와 함께 접힌 상태로 표시하는 메시지 규격입니다. \n"},"viewAll":{"type":"integer","default":150,"description":"viewAll(모두보기) 접힘 글자수 기준값을 지정합니다. \n\n* 유효값: 150(default), 300\n* 유효값 이외 수치가 입력되는 경우 defualt로 처리됩니다.\n"}}}}},"paths":{"/brand/{brandId}/layout":{"post":{"summary":"브랜드 내에서 사용할 수 있는 레이아웃을 등록 합니다.  \n","description":"브랜드 내에서 사용할 수 있는 레이아웃을 등록 합니다.  \n\n  + **계정 권한: 대행사**  \n  + **브랜드 권한: 운영자**\n","parameters":[{"$ref":"#/components/parameters/BrandKey"},{"$ref":"#/components/parameters/BrandId"}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/RegBrandLayout"}}}},"responses":{"200":{"description":"페이지 내 Response 섹션 참조"}}}}}}
```

### ❖ request body sample

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

```
{
    "layoutName": "SMS_{{YYYYMMDDHHmmss}}",
    "productCode": "sms,
    "headerComposition": [
        {
            "index": 0,
            "componentId": "CP-MainTitle",
            "options": {
                "leftAlign": "left",
                "rightAlign": "right",
                "leftTextStyle": "normal",
                "rightTextStyle": "normal",
                "maxCount": 5
            }
        }
    ],
    "bodyComposition": [
        {
            "index": 1,
            "componentId": "CP-Description",
            "options": {
                "leftAlign": "left",
                "rightAlign": "right",
                "leftTextStyle": "normal",
                "rightTextStyle": "normal",
                "maxCount": 5
            }
        }        
    ],
    "footerComposition": []
}
```

{% endtab %}

{% tab title="LMS" %}

```
{
    "layoutName": "LMS_{{YYYYMMDDHHmmss}}",
    "productCode": "lms",
    "headerComposition": [
        {
            "index": 0,
            "componentId": "CP-MainTitle",
            "options": {
                "leftAlign": "left",
                "rightAlign": "right",
                "leftTextStyle": "normal",
                "rightTextStyle": "normal",
                "maxCount": 5
            }
        }
    ],
    "bodyComposition": [
        {
            "index": 1,
            "componentId": "CP-Description",
            "options": {
                "leftAlign": "left",
                "rightAlign": "right",
                "leftTextStyle": "normal",
                "rightTextStyle": "normal",
                "maxCount": 5
            }
        },
        {
            "index": 1,
            "componentId": "CP-HButton",
            "options": {
                "leftAlign": "left",
                "rightAlign": "right",
                "leftTextStyle": "normal",
                "rightTextStyle": "normal",
                "maxCount": 5
            }
        },
        {
            "index": 1,
            "componentId": "CP-Description",
            "options": {
                "leftAlign": "left",
                "rightAlign": "right",
                "leftTextStyle": "normal",
                "rightTextStyle": "normal",
                "maxCount": 5
            }
        },
        {
            "index": 1,
            "componentId": "CP-VButton",
            "options": {
                "leftAlign": "left",
                "rightAlign": "right",
                "leftTextStyle": "normal",
                "rightTextStyle": "normal",
                "maxCount": 1
            }
        }
    ],
    "footerComposition": []
}
```

{% endtab %}

{% tab title="MMS" %}

```
{
    "layoutName": "MMS_{{YYYYMMDDHHmmss}}",
    "productCode": "mms",
    "headerComposition": [
        {
            "index": 0,
            "componentId": "CP-ImageSquare"
        }
    ],
    "bodyComposition": [
        {
            "index": 1,
            "componentId": "CP-Description",
            "options": {
                "leftAlign": "left",
                "rightAlign": "right",
                "leftTextStyle": "normal",
                "rightTextStyle": "normal",
                "maxCount": 5
            }
        },
        {
            "index": 1,
            "componentId": "CP-ItemA",
            "options": {
                "leftAlign": "left",
                "rightAlign": "right",
                "leftTextStyle": "normal",
                "rightTextStyle": "normal",
                "maxCount": 5
            }
        },
        {
            "index": 1,
            "componentId": "CP-HButton",
            "options": {
                "leftAlign": "left",
                "rightAlign": "right",
                "leftTextStyle": "normal",
                "rightTextStyle": "normal",
                "maxCount": 5
            }
        }        
    ],
    "footerComposition": []
}
```

{% endtab %}
{% endtabs %}

## Response

<table data-full-width="true"><thead><tr><th width="147">필드명</th><th width="141">타입</th><th width="68" align="center">길이</th><th width="108" align="center">필수여부</th><th width="118">기본값</th><th>설명</th></tr></thead><tbody><tr><td><a href="#result-array-less-than-object-greater-than"><mark style="color:blue;"><strong><code>result</code></strong></mark></a></td><td>array&#x3C;object></td><td align="center"></td><td align="center">O</td><td></td><td>레이아웃 ID(= messagebaseId)</td></tr><tr><td><strong><code>code</code></strong></td><td>string</td><td align="center">5</td><td align="center">O</td><td>20000000</td><td></td></tr><tr><td><strong><code>status</code></strong></td><td>integer</td><td align="center">3</td><td align="center">O</td><td>200</td><td></td></tr><tr><td><strong><code>desc</code></strong></td><td>string</td><td align="center"></td><td align="center">O</td><td></td><td></td></tr></tbody></table>

### <mark style="color:blue;">result</mark> - array\<object>

<table data-full-width="true"><thead><tr><th width="147">필드명</th><th width="141">타입</th><th width="68" align="center">길이</th><th width="108" align="center">필수여부</th><th width="118">기본값</th><th>설명</th></tr></thead><tbody><tr><td><strong><code>layoutId</code></strong></td><td>string</td><td align="center"></td><td align="center"></td><td></td><td><p>등록된 레이아웃 ID(= messagebaseId) 입니다.</p><p>레이아웃 ID는 RCS 발송에 사용하는 messagebaseId 로 사용됩니다.</p></td></tr></tbody></table>

### ❖ response body sample

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

```
{
    "code": "20000000",
    "desc": null,
    "result": [
        {
            "layoutId": "CLMBR.0a81DDlZjz-11GLm0hv4RX9zJB82D9r"
        }
    ],
    "status": 200
}
```

{% endtab %}

{% tab title="400" %}

```
{
    "error": {
        "code": "64001",
        "message": "Missing X-RCS-BrandKey header"
    },
    "status": 400
}
```

{% endtab %}

{% tab title="401" %}

```
{
    "error": {
        "code": "61003",
        "message": "Invalid token"
    },
    "status": 401
}
```

{% endtab %}

{% tab title="403" %}

```
{
    "error": {
        "code": "63001",
        "message": "No Brand Permission"
    },
    "status": 403
}
```

{% endtab %}
{% endtabs %}

{% hint style="warning" %}
error code는 [RCS Biz Center - Response body error code](https://apidocs.rcsbizcenter.com/error_code#rcs-biz-center-response-body-error-code) 참조
{% endhint %}
