Skip to content

Create Object Classification Configuration



POST /api/v1/objc_cfg/create

Overview

Create an object classification configuration

Body Request Parameters

Parameter Name Type Required Description
sourceType string Y Source type, default value is custom_object
Allow null: False
Example: custom_object
Optional values: ['object', 'custom_object']
objcGroupUUID string Business group UUID
Allow null: False
Example: objcg_xxxx
Allow empty string: True
Maximum length: 64
fields array Custom attribute fields (the reported data must contain these fields, otherwise the reported data will be discarded)
Allow null: False
Example: [{'name': 'ak', 'alias': 'machine gun'}]
templateInfo json Template configuration information
Allow null: False
Example: {}

Additional Parameter Descriptions


Description of the fields parameter This parameter stores bound field information in list form. The parameters for list members are as follows:

Parameter Name Type Description
name string Field name
alias string Field alias

Description of the templateInfo parameter

For detailed structure description, please refer to [Create Resource Explorer - JSON Configuration - Template Configuration Description]

1. Description of the source parameter Defines the resource's category and the text content that needs to be displayed on the UI page. The parameters for list members are as follows:

Parameter Name Type Description
key string Resource class
name string Resource class alias

2. Description of the filters parameter Defines the default display fields in the quick filter section of the resource explorer, formatted as shown below:

"filters":[
  {
    "key":"field name"
  },
  {
    "key":"field name"
  }
]

3. Description of the columns parameter Defines the default display fields in the list of the resource explorer, formatted as shown below:

"columns":[
  {
    "key":"field name",
  },
  {
    "key":"field name",
  }
]

4. Description of the views parameter

Parameter Required Description Example Write Method
title / Tab display title "text"
required false Whether the tab page is hidden, fixed value: true, false.
  • true: Hidden by default, linked with keys configuration to determine if data matches; if it matches, then it displays
  • false: Displayed by default
"false"
keys / Linked with the required parameter, can configure key fields and matching logic for field values, displaying when matched. Note: In this case, the required parameter value must be true
  • {"key":"*"} : Data satisfies the key field
  • {"key":"value"} : Data contains the key field and its value must be value
  • {"key1":"value1","key2":"value2"} : Data contains key1 field with value value1 and key2 field with value value2 combination
timerange default Definition of the time range for querying interface data. Basic format:
  • default: Follows the platform's default time widget configuration, usually 15m (i.e., query the latest 15 minutes of data)
  • Relative time: Custom relative time range, time units include m(minutes), h(hours), d(days)
  • Data time field configuration linked offset ["before offset", "after offset"]
  • "default" : Latest 15 minutes
  • "15m" : Latest 15 minutes
  • "1h" : Latest 1 hour
  • "1d" : Latest 1 day
  • ["15m","15m"] : Offset 15 minutes before and after the current data time
  • ["5m","30m"] : Offset 5 minutes before and 30 minutes after the current data time
viewType / Page type. Currently supports two types: "built-in page" and "built-in view", corresponding to "component" and "dashboard". /
viewName / Page name. If the page type is a built-in page, fill in the relative path address of the page; if the page type is a built-in view, fill in the view name only. Refer to the following [Associated Built-in Page][Associated Built-in View] descriptions /

5. Example of templateInfo parameter

{
  "main": [
    {
      "class":"custom_object",
      "source": {
        "key":"resource classification",
        "name":"resource classification alias"
      },
      "filters":[
        {
          "key":"field name"
        },
        {
          "key":"field name"
        }
      ],
      "table":{
        "columns":[
          {
            "key":"field name",
          },
          {
            "key":"field name",
          }
        ],
      },
      "detail":{
        "views":[
          {
            "title":"Tab Title",
            "required":"false",
            "keys":{},
            "view_type": "component",
            "viewName":"Built-in Page"
          },
          {
            "title":"Tab Title",
            "required":"false",
            "keys":{},
            "timerange":"default",
            "view_type": "dashboard",
            "viewName":"Built-in View"
          }
        ]
      }
    }
  ],
  "title": "Resource Classification or Alias"
}

Request Example

curl 'https://openapi.guance.com/api/v1/objc_cfg/create' \
-H 'DF-API-KEY: <DF-API-KEY>' \
-H 'Content-Type: application/json;charset=UTF-8' \
--data-raw '{"sourceType":"custom_object","objcGroupUUID":"objcg_xxxx","fields":[{"name":"name"}],"templateInfo":{"main":[{"class":"custom_object","source":{"key":"test","name":""},"filters":[],"fills":[],"groups":[],"table":{"columns":[],"detail":{"views":[{"keys":{},"viewType":"dashboard","viewName":"NtpQ Monitoring View","title":"viewer","required":true,"timerange":"default"}]}}}],"title":"test"}}' \
--compressed

Response

{
    "code": 200,
    "content": {
        "sourceType": "custom_object",
        "name": "test",
        "alias": "",
        "workspaceUUID": "wksp_xxxx",
        "objcGroupUUID": "objcg_xxx",
        "dashboardBindSet": [],
        "fields": [
            {
                "name": "name"
            }
        ],
        "extend": {
            "fills": [],
            "groups": [],
            "columns": [],
            "filters": [],
            "iconSet": {},
            "tableDetailViews": [
                {
                    "keys": {},
                    "viewType": "dashboard",
                    "viewName": "NtpQ Monitoring View",
                    "title": "viewer",
                    "required": true,
                    "timerange": "default"
                }
            ]
        },
        "id": 260,
        "uuid": "objc_xxxx",
        "status": 0,
        "creator": "acnt_xxxx",
        "updator": "acnt_xxxx",
        "createAt": 1734576782,
        "deleteAt": -1,
        "updateAt": 1734590084.4779553
    },
    "errorCode": "",
    "message": "",
    "success": true,
    "traceId": "96555412482790535"
} 

Feedback

Is this page helpful? ×