CreateCustomSchema
- Print
- PDF
CreateCustomSchema
- Print
- PDF
Article summary
Did you find this summary helpful?
Thank you for your feedback
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 name | Requirement status | Type | Restrictions | Description |
---|---|---|---|---|
prodName | Yes | String | Schema name | |
fields | Yes | List | Definition of the product schema | |
useCustomResource | No | Boolean | default: false | Custom 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 name | Requirement status | Type | Restrictions | Description |
---|---|---|---|---|
name | Yes | String | Name of product schema | |
dataType | Yes | DataType | - 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 |
metric | No | Boolean | default : false | Specify that the field is metric |
dimension | No | Boolean | default : false | Specify that the field is dimension |
counter | No | Boolean | default : false | |
isIdDimension | No | Boolean | Default: 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. |
aggregations | No | Map<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 |
desc | No | String | Description 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?