Skip to content

Create



POST /api/v1/objc_cfg/create

Overview

Create Resource Catalog 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 (Reported data must contain these fields, otherwise the reported data will be discarded)
Allow empty: False
Example: [{'name': 'ak', 'alias': '机枪'}]
templateInfo json Template configuration information
Allow empty: False
Example: {}

Parameter Supplementary Explanation


fields Parameter Description This parameter stores the bound field information in a list format. The list member parameters are as follows

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

templateInfo Parameter Description

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

1. source Parameter Description Defines 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 Class
name string Resource Class alias

2. filters Parameter Description Defines the default listed display fields for the resource explorer in the quick filter section. The format is as follows:

"filters":[
  {
    "key":"Field Name"
  },
  {
    "key":"Field Name"
  }
]

3. columns Parameter Description Defines the default listed display fields for the resource explorer in the list. The format is as follows:

"columns":[
  {
    "key":"Field Name",
  },
  {
    "key":"Field Name",
  }
]

4. views Parameter Description

Parameter Required Description Writing Example
title / Tab display title "Text"
required false Whether the Tab page is not displayed by default. Fixed values: true, false.
  • true: Not displayed by default, linked with the keys configuration to determine if the data matches. If it matches, it is displayed
  • false: Displayed by default
"false"
keys / Linked with the required parameter. Key fields and field value matching logic can be configured. Displayed if matched. Note: When this parameter is applied, the required parameter value must be true
  • {"key":"*"} : Data satisfies the key field
  • {"key":"value"} : The key field must exist in the data and its value must be value
  • {"key1":"value1","key2":"value2"} : The data must contain the key1 field with value value1 and the key2 field with value value2 in combination
timerange default Definition of the data query time range in the interface. Basic format:
  • default: Follows the platform Time Widget default configuration, usually 15m (i.e., query data from the last 15 minutes)
  • Relative time: Custom relative time range. Time units include m (minutes), h (hours), d (days)
  • Link the data time field to configure the offset period before and after ["forward offset","backward offset"]
  • "default" : Last 15 minutes
  • "15m" : Last 15 minutes
  • "1h" : Last 1 hour
  • "1d" : Last 1 day
  • ["15m","15m"] : Offset 15 minutes forward and 15 minutes backward respectively based on the current data time
  • ["5m","30m"] : Offset 5 minutes forward and 30 minutes backward respectively based on the current data time
viewType / Page type. Currently supports "Built-in Page" and "Built-in View" types, corresponding to "component" and "dashboard" respectively. /
viewName / Page name. If the page type is a built-in page, the relative path address of the page needs to be filled in; if the page type is a built-in view, the view name can be filled in. Refer to the [Associate Built-in Page] [Associate Built-in View] description below. /

5. templateInfo Parameter Example

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