Creating a Metadata (2.1.18)
Function
This API is used to create a metadata file.
URI
POST /v2/{project_id}/graphs/metadatas
|
Parameter |
Mandatory |
Type |
Description |
|---|---|---|---|
|
project_id |
Yes |
String |
Definition Project ID. For details about how to obtain a project ID, see Obtaining a Project ID. Constraints N/A Range The value can contain up to 64 characters. Only letters and digits are allowed. Default Value N/A |
Request Parameters
|
Parameter |
Mandatory |
Type |
Description |
|---|---|---|---|
|
X-Auth-Token |
Yes |
String |
Definition User token. It is used to obtain the permission to call APIs. For how to obtain the token, see Authentication. (The token is the value of X-Subject-Token in the response header.) Constraints N/A Range N/A Default Value N/A |
|
Parameter |
Mandatory |
Type |
Description |
|---|---|---|---|
|
metadata_path |
Yes |
String |
Definition Metadata storage path. Constraints N/A Range N/A Default Value N/A |
|
name |
Yes |
String |
Definition Metadata file name. Constraints The value can contain up to 64 characters. Only letters, digits, and underscores (_) are allowed. Range N/A Default Value N/A |
|
description |
Yes |
String |
Definition Metadata file description. Constraints N/A Range N/A Default Value N/A |
|
is_overwrite |
Yes |
Boolean |
Definition Whether to overwrite existing files. Constraints N/A Range
Default Value N/A |
|
ges_metadata |
Yes |
ges_metadata object |
Definition Object that stores message information for metadata. Constraints N/A Range N/A Default Value N/A |
|
Parameter |
Mandatory |
Type |
Description |
|---|---|---|---|
|
labels |
Yes |
Array of labels objects |
Definition Label list. Constraints N/A Range N/A Default Value N/A |
Response Parameters
Status code: 200
|
Parameter |
Type |
Description |
|---|---|---|
|
id |
String |
Definition Metadata file ID. Range N/A |
|
name |
String |
Definition Metadata file name. Range N/A |
Status code: 400
|
Parameter |
Type |
Description |
|---|---|---|
|
error_code |
String |
Definition System prompt.
Range N/A |
|
error_msg |
String |
Definition System prompt.
Range N/A |
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" : "unionsdk_test"
}
Status code: 400
Example response for a failed request
{
"error_msg" : "The metadata file already exists.",
"error_code" : "GES.2067"
}
Status Codes
|
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 Codes
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.See the reply and handling status in My Cloud VOC.
For any further questions, feel free to contact us through the chatbot.
Chatbot