# 차원 테이블 API
호출 방법은 오픈 API 문서의 호출 방법 설명을 참조하십시오.
# 1. 차원 테이블 생성
note
- 요청 본문은 차원 테이블의 내용이며, 차원 테이블 생성 매개변수 
createParam의 구성을 참조하십시오. - 기본 최대 파일 제한은 200M입니다.
 
인터페이스 URL
/open/dict-create?token=xxx&projectId=0
요청 방법
POST
콘텐츠 유형
text/csv
요청 쿼리 파라미터
Parameter name  |  Sample value  |  Parameter type  |  Is required  |  Parameter description  | 
|---|---|---|---|---|
token  |  xxx  |  String  |  Yes  |  token  | 
projectId  |  0  |  Integer  |  Yes  |  Project ID  | 
createParam  |  {"mainColumn":{"property":{"columnName":"channel","tableType":"event"}},"columns":[{"property":{"columnName":"channel_id","selectType":"string"}},{"property":{"columnName":"channel_name","columnDesc":"channel type","selectType":"string"}}]}  |  String  |  Yes  |  Create dimension column information description  | 
차원 테이블 생성 파라미터 CreateParam 구성
차원 속성 생성 
여기서 주요 필드는 channel이며, 이는 차원 테이블의 channel_id와 연관되며 차원 테이블 속성인 channel_name을 추가합니다.
- 차원 테이블 예시
 
차원 테이블 데이터는 csv 형식이며, 첫 번째 열은 필드와 연관됩니다.
첫 번째 행은 열 이름이며, 두 번째 행부터 데이터가 시작됩니다.
channel_id,channel_name
1. Longteng Area 1
2. Longteng Zone 2
3. Longteng Zone 3
- createParam 예시 (거래 테이블의 
channel필드에 대한 위의 차원 테이블 생성). 
열 목록에서 요소의 순서는 차원 테이블 데이터의 열 순서 및 명명과 일치해야 합니다. 첫 번째 요소(연관된 첫 번째 열에 해당)는 상위 요소와 동일한 이름을 사용할 수 있으며, 다를 경우에는 첫 글자만 다르고 알파벳 숫자 밑줄만 포함할 수 있습니다.
{
  "mainColumn": {
    "property": {
      "columnName": "channel",
      "tableType": "event",
      "timestampJoinFormat": null
    }
  },
  "columns": [
    {
      "property": {
        "columnName": "channel_id",
        "selectType": "number"
      }
    },
    {
      "property": {
        "columnName": "channel_name",
        "columnDesc": "channel type",
        "selectType": "string"
      }
    }
  ]
}
- createParam 필드 설명
 
MainColumn 노드 (차원 테이블을 생성하는 주요 필드 설명 노드)
Attribute name  |  Attribute description  | 
|---|---|
property  |  Main attributes (both physical and virtual)  | 
columnName  |  Main property field name  | 
tableType  |  The main attribute belongs to the table type, event: event attribute; user: user feature  | 
timestampJoinFormat  |  If the main attribute is a timestamp, it is supported to bind the dimension attribute after granularity calculation by timestamp  | 
TimestampJoinFormat은 다음과 같은 세분화 유형을 지원합니다.
Value  |  Description  | 
|---|---|
DATE_STR_YEAR  |  Attributes will be formatted as "yyyy" string after binding dimension attributes  | 
DATE_STR_MONTH  |  The attribute will be formatted as "yyyy-MM" after binding the dimension attribute  | 
DATE_STR_DAY  |  The attribute will be formatted as "yyyy-MM-dd" after binding the dimension attribute  | 
DATE_STR_HOUR  |  The attribute will be formatted as "yyyy-MM-dd hh" after binding the dimension attribute  | 
DATE_STR_MINUTE  |  The attribute will be formatted as "yyyy-MM-dd HH: mm" after binding the dimension attribute  | 
DATE_STR_SECOND  |  The attribute will be formatted as "yyyy-MM-dd HH: mm: ss" after binding the dimension attribute  | 
DATE_STR_MILLISECOND  |  The attribute will be formatted as "yyyy-MM-dd HH: mm: ss. SSS" after binding the dimension attribute  | 
열 목록 (차원 필드 설명 노드)
열 목록에서 요소의 순서는 차원 테이블 데이터의 열 순서와 일치해야 합니다.
| Attribute name | Attribute description | 
|---|---|
| property | Dimension field attribute list | 
| columnName | Dimension field name | 
| columnDesc | Dimension field description, that is, the display name of the field (optional) | 
| selectType | Dimension field types: number value, bool boolean, string string, datetime date type | 
생성이 성공하면 channel@channel_name이라는 차원 테이블 속성을 찾을 수 있습니다.

성공적인 응답 예시
{
  "data": {
    "duplcatedMainKeyColumns": ["activity_type@type_test"],
    "duplcatedMainKeyLineNum": 2,
    "mainKeyErrorColumns": ["activity_type@type_test"],
    "mainKeyErrorLineNum": 3,
    "successLineNum": 27,
    "totalLineNum": 40,
    "typeErrorColumns": ["numwrong_test", "boolwrong_test"],
    "typeErrorLineNum": 8
  },
  "return_code": 0,
  "return_message": "success"
}
$$Parameter name  |  Sample value  |  Parameter type  |  Parameter description | 
|---|---|---|---|
return_code  |  0  |  Integer  |  Return code | 
return_message  |  success  |  String  |  Return information | 
data  |  -  |  Object  |  Return result | 
data.duplcatedMainKeyColumns  |  ["activity_type@type_test"]  |  List  |  Duplicate column names associated with primary fields | 
data.duplcatedMainKeyLineNum  |  2  |  Integer  |  Number of duplicate rows associated with primary field (automatically discarded) | 
data.mainKeyErrorColumns  |  ["activity_type@type_test"]  |  List  |  Column name associated with primary field analysis error | 
data.mainKeyErrorLineNum  |  3  |  Integer  |  The number of rows associated with the main field analysis error (will be automatically discarded) | 
data.successLineNum  |  27  |  Integer  |  Number of successful lines | 
data.totalLineNum  |  40  |  Integer  |  Total number of rows | 
data.typeErrorColumns  |  ["numwrong_test", "boolwrong_test"]  |  List  |  Other field type wrong column name | 
data.typeErrorLineNum  |  8  |  Integer  |  Number of lines with other field types wrong (will be left blank) | 
오류 응답 예시
{
    "return_code": -1008,
    "return_message": "Upload file size cannot exceed 209715200 bytes"
}
Parameter name  |  Sample value  |  Parameter type  |  Parameter description  | 
|---|---|---|---|
return_code  |  -1100  |  Integer  |  Return code  | 
return_message  |  Upload file size cannot exceed 209715200 bytes  |  String  |  Return information  | 
Curl Example
curl --header 'Content-Type: text/csv' --data-binary '@test.csv' 'http://ta2:8992/open/dict-create?token=bTOzKiTIozG4e19FgXphcA8dDV3DIY8RwdHTO7aSnBsRqSNaIk19BnBMecJDWibD&projectId=377&createParam=%7B%22mainColumn%22%3A%7B%22property%22%3A%7B%22columnName%22%3A%22channel%22%2C%22tableType%22%3A%22event%22%7D%7D%2C%22columns%22%3A%5B%7B%22property%22%3A%7B%22columnName%22%3A%22channel_id%22%2C%22selectType%22%3A%22string%22%7D%7D%2C%7B%22property%22%3A%7B%22columnName%22%3A%22channel_name%22%2C%22columnDesc%22%3A%22%E6%B8%A0%E9%81%93%E7%B1%BB%E5%9E%8B%22%2C%22selectType%22%3A%22string%22%7D%7D%5D%7D'
