You need to enable JavaScript to run this app.
Growth Analysis (Privatization)

Growth Analysis (Privatization)

Copy page
Download PDF
User Tag V1.0
Create Tags Based on Uploaded Files
Copy page
Download PDF
Create Tags Based on Uploaded Files

Instructions for use

This OpenAPI provides you with the ability to create tags based on uploaded files. Currently, it is not supported to append or modify created tags.

Request description

Path:/openapi/v1/app/{app_id}/tag
Method: POST
Content-type: application/json

Request parameters

Path-parameters: Just refer to the public parameters
Body:

{
    "name": "tag_test_tag",  # "name" must start with "tag_"
    "show_name": "test tag",
    "value_type": "string",
    "description": "",
    "create_type": "upload",
    "refresh_rule": "manual",
    "tag_rule": {
        "file": {
            "file_key": "tag_upload_uuid/164314/20220527/564b19debe5a448396504802ab5ea69a.json",  # file_key 需要和上传标签数据得到的返回结果一致
            "detail": {
                "name": "user_tag.csv"
            }
        }
    }
}

Field meaning description

Field

Type

Description

Required

name

string

Label name must start with "tag_", unique within the application. Rule reference:User Tags.

true

show_name

string

Label display name, unique within the application.

true

value_type

string

Value types (enumeration types): int, string, float, datetime

true

description

string

Description, can be empty

false

create_type

string

Create type, fixed here is upload

true

refresh_rule

string

Refresh Type: manual, daily, upload files Fixed Refresh Type as manual

true

tag_rule.file.file_key

string

The file path of the system needs to be consistent with the return result obtained by the upload file API

false

tag_rule.file.detail.name

string

file name

false

Back to example

Response:

{
    "code": 200,
    "message": "success",
    "data": {
        "tag_name": "tag_test_tag"
    },
    "total_execute_time": null
}

Field meaning description

Field

Type

Description

code

int

status code

message

string

Return message

tag_name

string

Create a successful label name

total_execute_time

int

Total execution time

Request example

Bc is the RangersClient created. For its initialization, please refer to the "OpenAPI SDK Instructions". SDKs in various languages provide similar interfaces.
Call (Python):

method = 'POST'
service_url = '/datatag/openapi/v1/app/164314/tag'
body = {
    "name": "tag_test_tag", 
    "show_name": "test tag",
    "value_type": "string",
    "description": "",
    "create_type": "upload",
    "refresh_rule": "manual",
    "tag_rule": {
        "file": {
            "file_key": "tag_upload_uuid/164314/20220527/564b19debe5a448396504802ab5ea69a.json",
            "detail": {
                "name": "user_tag.csv"
            }
        }
    }
}
resp = bc.request(method=method, service_url=service_url, body=body)
print(resp.content.decode('utf-8'))

Call (Java):

String method = "POST";
String serviceUrl = "/datatag/openapi/v1/app/164314/tag";
HashMap<String, String> headers = null;
HashMap<String, String> params = null;
String body = "{\n" +
        "    \"name\": \"tag_test_tag\",\n" +
        "    \"show_name\": \"test tag\",\n" +
        "    \"value_type\": \"string\",\n" +
        "    \"description\": \"\",\n" +
        "    \"create_type\": \"upload\",\n" +
        "    \"refresh_rule\": \"manual\",\n" +
        "    \"tag_rule\": {\n" +
        "        \"file\": {\n" +
        "            \"file_key\": \"tag_upload_uuid/164314/20220527/564b19debe5a448396504802ab5ea69a.json\",\n" +
        "            \"detail\": {\n" +
        "                \"name\": \"user_tag.csv\"\n" +
        "            }\n" +
        "        }\n" +
        "    }\n" +
        "}";

String resp = bc.request(method, serviceUrl, headers, params, body);
System.out.println(resp);

Back to example

Return result:

{
    "code": 200,
    "message": "success",
    "data": {
        "tag_name": "tag_test_tag"
    },
    "total_execute_time": null
}

Last updated: 2026.08.25 14:04:55