CreateCustomSchema
    • PDF

    CreateCustomSchema

    • PDF

    Article Summary

    Summary

    Create a user-defined schema.

    Request

    API URL

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

    Request header

    The request headers specified in common settings are required.

    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}
    

    Request body

    Parameter nameRequirement statusTypeRestrictionsDescription
    prodNameYesStringSchema name
    fieldsYesListDefinition of the product schema
    useCustomResourceNoBooleandefault: falseCustom resource use status

    FieldDto

    Statement

    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;
    

    Field

    Parameter nameRequirement statusTypeRestrictionsDescription
    nameYesStringName of product schema
    dataTypeYesDataType- If the field is metric, STRING, INTEGER, FLOAT, and LONG types are valid,
    - and if the field is dimension, then STRING type is valid.
    Specify the data type of metric or dimension
    metricNoBooleandefault : falseSpecify that the field is metric
    dimensionNoBooleandefault : falseSpecify that the field is dimension
    counterNoBooleandefault : false
    isIdDimensionNoBooleanDefault: false. At least one dimension must be set as idDimension.- Can be set only when the field is dimension
    - When creating an event rule for a product defined by the user, it is classified based on the corresponding dimension.
    aggregationsNoMap<Interval, Set>- interval : Min1, Min5, Min30, Hour2, Day1
    - Calculation : COUNT,SUM,MAX,MIN,AVG
    - Can be set only when the corresponding field is metric
    - Set the aggregation interval and aggregation function
    descNoStringDescription of product schema

    Examples

    Request example

    The example below shows how to create a schema called MyProduct that uses a custom resource.

    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
    }
    

    Response example

    If the view is completed without any errors, then a response in simple JSON format including HTTP code 200 and product key (cw_key) is returned.

    {
      "cw_key": "xxxxxxxxxxxxxxxxxx"
    }
    

    Was this article helpful?

    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.