Import¶
POST /api/v1/tag/import
Overview¶
Bulk import global tag templates, supporting duplicate name checking, skipping, and overwriting.
Body Request Parameters¶
| Parameter Name | Type | Required | Description |
|---|---|---|---|
| tags | array | Y | List of tag templates Allow empty: False |
| tags[*] | None | ||
| tags[*].name | string | Y | Tag name Allow empty: False |
| tags[*].description | string | Tag description Allow empty: False |
|
| tags[*].colour | string | Tag color Allow empty: False |
|
| repeatTagNameOp | string | Duplicate tag name handling strategy Allow empty: False Optional values: ['check', 'skip', 'recover'] |
Parameter Supplementary Description¶
This API is used to import global tag templates individually.
Calling Process
- Prepare the
tagsarray, where each element represents a tag template. - Specify the handling strategy for encountering duplicate tag names via
repeatTagNameOp. - If the strategy is
checkand duplicate tag names exist, the API will directly returnrepeat_namewithout performing database operations.
repeatTagNameOp Description
| Value | Description |
|---|---|
| check | Only check for duplicates; returns repeat_name if duplicate tag names exist |
| skip | Skip existing duplicate tag names, only import non-existent tags |
| recover | When a duplicate tag name exists in the target workspace, overwrite its description and colour |
Template Fields
| Field | type | Required | Description |
|---|---|---|---|
| name | string | Yes | Tag name |
| description | string | No | Tag description |
| colour | string | No | Tag color |
Return Description
- Returns
successCount,failCountupon successful import execution. - If some objects fail to execute, the response will additionally include
failedNames. - Returns
repeat_nameif duplicates are found incheckmode.
Request Example¶
curl 'https://openapi.truewatch.com/api/v1/tag/import' \
-H 'DF-API-KEY: <DF-API-KEY>' \
-H 'Content-Type: application/json' \
--data-raw '{"repeatTagNameOp":"recover","tags":[{"name":"核心服务","description":"核心服务标签","colour":"style_key3"}]}'