Skip to content

Resource Class Configuration Create



POST /api/v1/objc_cfg/create

Overview

Create Resource Class Configuration

Body Request Parameters

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

Parameter Supplementary Explanation


fields Parameter Explanation This parameter stores the bound field information in the form of a list, and the list member parameters are as follows

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

templateInfo Parameter Explanation

For detailed structure explanation, please refer to 【Create Resource Explorer-JSON Configuration-Template Configuration Explanation】

1. source Parameter Explanation Define the resource category and the text content that the category needs to display on the UI page. The list member parameters are as follows

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

2. filters Parameter Explanation Define the default listed display fields in the quick filter of the resource explorer, the format is as follows:

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

3. columns Parameter Explanation Define the default listed display fields in the list of the resource explorer, the format is as follows:

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

4. views Parameter Explanation

Parameter Required Description Example
title / Tab display title "text"
required false Whether the tab page is not displayed, fixed values: true, false.
  • true: not displayed by default, judge whether the data matches by linkage with keys configuration, display if matched
  • false: displayed by default
"false"
keys / Linkage with required parameter, key fields and field value matching logic can be configured, display if matched. Note: when this parameter is applied, the required parameter value must be true
  • {"key":"*"} : data satisfies key field
  • {"key":"value"} : key field exists in data and the value must be value
  • {"key1":"value1","key2":"value2"} : key1 field exists in data and the value is value1 and key2 field exists and the value is value2 combination
timerange default Interface data query time range definition. Basic format:
  • default: follow the platform time widget default configuration, generally 15m (i.e. query the last 15 minutes data)
  • relative time: custom relative time range, time units are m(minute), h(hour), d(day)
  • linkage with data time field configuration front and back offset time period["front offset","back offset"]
  • "default" : last 15 minutes
  • "15m" : last 15 minutes
  • "1h" : last 1 hour
  • "1d" : last 1 day
  • ["15m","15m"] : offset 15 minutes forward and backward respectively according to the current data time
  • ["5m","30m"] : offset 5 minutes forward and 30 minutes backward according to the current data time
viewType / Page type. Currently supports "built-in page" and "built-in view" two types, corresponding to "component" and "dashboard" respectively. /
viewName / Page name. If the page type is built-in page, you need to fill in the relative path address of the page; if the page type is built-in view, fill in the view name. Refer to the following 【Associate Built-in Page】【Associate Built-in View】 explanation /

5. templateInfo Parameter Example

{
  "main": [
    {
      "class":"custom_object",
      "source": {
        "key":"resource category",
        "name":"resource category 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 category 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 Monitor 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 Monitor 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? ×