CreateCustomSchema
    • PDF

    CreateCustomSchema

    • PDF

    Article Summary

    개요

    사용자 정의 스키마를 생성합니다.

    요청

    API URL

    URL: https://cw.apigw.ntruss.com/cw_fea/real/cw/api/schema
    Method: POST
    

    요청 헤더

    공통 설정에 명시된 요청 헤더가 필요합니다.

    Content-Type: application/json
    x-ncp-apigw-signature-v2: {generated signature}
    x-ncp-apigw-timestamp: {current timestamp}
    x-ncp-iam-access-key: {your iam access key}
    

    요청 바디

    파라미터명필수 여부타입제약 사항설명
    prodNameYesString스키마 이름
    fieldsYesList상품 스키마 정의
    useCustomResourceNoBooleandefault: falsecustom resource 사용 여부

    FieldDto

    구문

    private String name;
    private DataType dataType;
    private boolean metric = false;
    private boolean dimension = false;
    private Boolean counter = false;
    private boolean isIdDimension = false;
    private Map<Interval, Set<Calculation>> aggregations;
    private String desc;
    

    필드

    파라미터명필수 여부타입제약 사항설명
    nameYesStringProduct Schema 이름
    dataTypeYesDataType해당 field가 Metric일 경우 STRING, INTEGER, FLOAT, LONG
    해당 field가 Dimension일 경우 STRING 타입이 유효
    Metric 혹은 Dimension의 DataType을 명시
    metricNoBooleandefault : false해당 field가 Metric임을 명시
    dimensionNoBooleandefault : false해당 field가 Dimension임 명시
    counterNoBooleandefault : false
    isIdDimensionNoBooleandefault : false이며 반드시 하나의 Dimension은 idDimension으로 설정되어야 함해당 field가 Dimension 일 때만 설정 가능
    사용자가 정의한 상품에 대해 Event Rule 생성 시 해당 Dimension을 기준으로 구분됨
    aggregationsNoMap<Interval, Set>interval : Min1, Min5, Min30, Hour2, Day1
    Calculation : COUNT,SUM,MAX,MIN,AVG
    해당 field가 Metric 일때만 설정 가능
    집계 주기와 집계 함수 설정
    descNoStringProduct Schema 설명

    예시

    요청 예시

    아래 예시는 custom resource를 사용하는 MyProduct라는 스키마를 생성하는 예시입니다.

    POST /cw_fea/real/cw/api/schema
    Host: cw.apigw.ntruss.com
    Content-Type: application/json
    x-ncp-apigw-signature-v2: {generated signature}
    x-ncp-apigw-timestamp: {current timestamp}
    x-ncp-iam-access-key: {your iam access key}
    
    Payload:
    
    {
      "prodName": "Custom/MyProduct",
      "fields": [
        {
          "dataType": "STRING",
          "name": "dimensionName",
          "dimension": true,
          "metric": false,
          "counter": false,
          "idDimension": true,
          "desc": "description"
        },
        {
          "dataType": "FLOAT",
          "name": "metricName",
          "dimension": false,
          "metric": true,
          "counter": false,
          "desc": "description",
          "aggregations": {
              "Min1": [
                "AVG",
                "SUM",
                "MIN",
                "MAX",
                "COUNT"
              ],
              "Min5": [
                "AVG",
                "SUM",
                "MIN",
                "MAX",
                "COUNT"
              ],
              "Min30": [
                "AVG",
                "SUM",
                "MIN",
                "MAX",
                "COUNT"
              ],
              "Hour2": [
                "AVG",
                "SUM",
                "MIN",
                "MAX",
                "COUNT"
              ],
              "Day1": [
                "AVG",
                "SUM",
                "MIN",
                "MAX",
                "COUNT"
              ]
          }
        }
      ],
      "useCustomResource": true
    }
    

    응답 예시

    오류 없이 조회가 완료되면 HTTP code 200와 상품키(cw_key)를 포함한 간단한 JSON 형식의 응답이 리턴됩니다.

    {
      "cw_key": "xxxxxxxxxxxxxxxxxx"
    }
    

    이 문서가 도움이 되었습니까?

    Changing your password will log you out immediately. Use the new password to log back in.
    First name must have atleast 2 characters. Numbers and special characters are not allowed.
    Last name must have atleast 1 characters. Numbers and special characters are not allowed.
    Enter a valid email
    Enter a valid password
    Your profile has been successfully updated.