Help Center> RES> API Reference> API> Data Source> Modifying Features in a Data Source

Modifying Features in a Data Source

Function

This API is used to modify features in a data source.

URI

PUT /v2.0/{project_id}/workspaces/{workspace_id}/data-sources/{datasource_id}/data-struct

Table 1 Path parameters

Parameter

Mandatory

Type

Description

datasource_id

Yes

String

Data source ID

project_id

Yes

String

Project ID. For details on how to obtain the project ID, see Obtaining a Project ID.

workspace_id

Yes

String

Workspace ID

Table 2 Query parameters

Parameter

Mandatory

Type

Description

X-Auth-Token

Yes

String

User token. For details on how to obtain the user token, see Obtaining a User Token Through Password Authentication.

Request Parameters

Table 3 Request header parameters

Parameter

Mandatory

Type

Description

Content-Type

Yes

String

Content type. The value is application/json.

Table 4 Request body parameters

Parameter

Mandatory

Type

Description

item_attrs

Yes

Array of item_attrs objects

Item feature information

user_attrs

Yes

Array of user_attrs objects

User feature information

behaviors

Yes

BehaviorsConfig object

Behavior information

Table 5 item_attrs

Parameter

Mandatory

Type

Description

data_type

No

String

Data type

name

No

String

Item

other_uses

No

Array of strings

Other usage

Table 6 user_attrs

Parameter

Mandatory

Type

Description

data_type

No

String

Data type

name

No

String

Username

Table 7 BehaviorsConfig

Parameter

Mandatory

Type

Description

positive_behaviors

No

Array of behaviorWeights objects

Positive behavior

negative_behaviors

No

Array of behaviorWeights objects

Negative behavior

Table 8 behaviorWeights

Parameter

Mandatory

Type

Description

behavior_type

No

String

Behavior type

weight

No

Integer

Behavior weight

other_uses

No

Array of strings

Other usage

Response Parameters

Status code: 200

Table 9 Response body parameters

Parameter

Type

Description

is_success

Boolean

Whether the request is successful

message

String

Response message

error_code

String

Error code (This parameter is not returned when the request is successful.)

Example Requests

This API is used to confirm features in a data source.

/v2.0/testuuidxxxxxxxxxxxxxxxxxxxxxxxx/workspaces/testuuidxxxxxxxxxxxxxxxxxxxxxxxx/data-source/testuuidxxxxxxxxxxxxxxxxxxxxxxxx/data-struct

{
  "user_attrs" : [ {
    "name" : "age",
    "data_type" : "long",
    "modify_able" : false
  }, {
    "name" : "extend_float",
    "data_type" : "float",
    "modify_able" : false
  }, {
    "name" : "extend_long",
    "data_type" : "long",
    "modify_able" : false
  }, {
    "name" : "extend_strArray",
    "data_type" : "strArray",
    "modify_able" : false
  }, {
    "name" : "extend_string",
    "data_type" : "string",
    "modify_able" : false
  }, {
    "name" : "gender",
    "data_type" : "string",
    "modify_able" : false
  }, {
    "name" : "location",
    "data_type" : "location",
    "modify_able" : false
  }, {
    "name" : "tags",
    "data_type" : "strArray",
    "modify_able" : false
  }, {
    "name" : "userId",
    "data_type" : "string",
    "modify_able" : false
  } ],
  "item_attrs" : [ {
    "name" : "author",
    "data_type" : "strArray",
    "modify_able" : false
  }, {
    "name" : "category",
    "data_type" : "string",
    "modify_able" : false
  }, {
    "name" : "expireTime",
    "data_type" : "long",
    "modify_able" : false
  }, {
    "name" : "extend_float",
    "data_type" : "float",
    "modify_able" : false
  }, {
    "name" : "extend_long",
    "data_type" : "long",
    "modify_able" : false
  }, {
    "name" : "extend_strArray",
    "data_type" : "strArray",
    "modify_able" : false
  }, {
    "name" : "extend_string",
    "data_type" : "string",
    "modify_able" : false
  }, {
    "name" : "itemId",
    "data_type" : "string",
    "modify_able" : false
  }, {
    "name" : "itemType",
    "data_type" : "string",
    "modify_able" : false
  }, {
    "name" : "location",
    "data_type" : "location",
    "modify_able" : false
  }, {
    "name" : "publishTime",
    "data_type" : "long",
    "modify_able" : false
  }, {
    "name" : "score",
    "data_type" : "long",
    "modify_able" : false
  }, {
    "name" : "status",
    "data_type" : "long",
    "modify_able" : false
  }, {
    "name" : "tags",
    "data_type" : "strArray",
    "modify_able" : false
  } ],
  "behaviors" : {
    "positive_behaviors" : [ {
      "behavior_type" : "click",
      "weight" : 0.3
    }, {
      "behavior_type" : "like",
      "weight" : 0.8
    } ],
    "negative_behaviors" : [ {
      "behavior_type" : "view",
      "weight" : 0.1
    }, {
      "behavior_type" : "dislike",
      "weight" : 0.8
    } ]
  }
}

Example Responses

Status code: 200

OK

{
  "is_success" : true,
  "message" : "Successed to update data source."
}

Status Codes

Status Code

Description

200

OK

Error Codes

See Error Codes.