Adding Metadata
Function
This API is used to add metadata.
URI
POST /v2/{project_id}/graphs/metadatas
Parameter | Mandatory | Type | Description |
---|---|---|---|
project_id | Yes | String | Project ID. For details about how to obtain the project ID, see Obtaining a Project ID. |
Request Parameters
Parameter | Mandatory | Type | Description |
---|---|---|---|
X-Auth-Token | Yes | String | User token. The token can be obtained by calling the IAM API. (The token is the value of X-Subject-Token in the response header.) |
Parameter | Mandatory | Type | Description |
---|---|---|---|
metadata_path | Yes | String | Path for storing the metadata |
name | Yes | String | Metadata name, which contains 1 to 64 characters consisting of only letters, digits, and underscores (_) |
description | Yes | String | Metadata description |
is_overwrite | Yes | Boolean | Whether to overwrite the file. |
ges_metadata | Yes | ges_metadata object | Object for storing metadata message information. |
Parameter | Mandatory | Type | Description |
---|---|---|---|
labels | Yes | Array of labels objects | Label list |
Parameter | Mandatory | Type | Description |
---|---|---|---|
name | No | String | Name of a label |
properties | No | Array of Map<String,String> objects | Label property map |
Response Parameters
Status code: 200
Parameter | Type | Description |
---|---|---|
id | String | Metadata ID |
name | String | Metadata name |
Status code: 400
Parameter | Type | Description |
---|---|---|
error_code | String | System prompt code.
|
error_msg | String | System prompt code.
|
Example Request
Add metadata. The metadata is stored in devdata/unionsdk/unionsdk_test.xml. The metadata does not overwrite existing data, the metadata name is unionsdk_test, and the metadata description is test.
POST https://Endpoint/v2/{project_id}/graphs/metadatas{"metadata_path" : "devdata/unionsdk/unionsdk_test.xml","is_overwrite" : false,"name" : "unionsdk_test","description": " test","ges_metadata" : {"labels" : [ {"name" : "friends"}, {"name" : "movie","properties" : [ {"dataType" : "string","name" : "ChineseTitle","cardinality" : "single"}, {"dataType" : "int","name" : "Year","cardinality" : "single"}, {"dataType" : "string","name" : "Genres","cardinality" : "set"} ]}, {"name" : "user","properties" : [ {"dataType" : "string","name" : "ChineseName","cardinality" : "single"}, {"typeName1" : "F","typeName2" : "M","typeNameCount" : "2","dataType" : "enum","name" : "Gender","cardinality" : "single"}, {"typeName1" : "Under 18","typeName2" : "18-24","typeName3" : "25-34","typeName4" : "35-44","typeNameCount" : "7","dataType" : "enum","name" : "Age","typeName5" : "45-49","typeName6" : "50-55","cardinality" : "single","typeName7" : "56+"}, {"dataType" : "string","name" : "Occupation","cardinality" : "single"}, {"dataType" : "char array","name" : "Zip-code","maxDataSize" : "12","cardinality" : "single"} ]}, {"name" : "rate","properties" : [ {"dataType" : "int","name" : "Score","cardinality" : "single"}, {"dataType" : "date","name" : "Datetime","cardinality" : "single"} ]} ]}}
Example Response
Status code: 200
Example response for a successful request
{"id" : "ff8080815f9a3c84015f9a438ff70001","name" : "movie_schema"}
Status code: 400
Example response for a failed request
{"error_msg" : "The metadata file already exists.","error_code" : "GES.2067"}
Status Code
Return Value | Description |
---|---|
400 Bad Request | Request error |
401 Unauthorized | Authorization failed |
403 Forbidden | No operation permissions |
404 Not Found | No resources found |
500 Internal Server Error | Internal server error |
503 Service Unavailable | Service unavailable |
Error Code
See Error Code.
- Function
- URI
- Request Parameters
- Response Parameters
- Example Request
- Example Response
- Status Code
- Error Code