Updated on 2024-01-04 GMT+08:00

Querying Metadata

Function

This API is used to query the metadata of a graph.

URI

GET /v2/{project_id}/graphs/metadatas/{metadata_id}

Table 1 URI parameters

Parameter

Mandatory

Type

Description

project_id

Yes

String

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

metadata_id

Yes

String

Metadata ID

Request Parameters

Table 2 Request header parameter

Parameter

Mandatory

Type

Description

X-Auth-Token

Yes

String

User token.

It is used to obtain the permission to call APIs. For details about how to obtain the token, see Authentication. The value of X-Subject-Token in the response header is the token.

Response Parameters

Status code: 200

Table 3 Response body parameters

Parameter

Type

Description

encrypted

Boolean

Whether metadata is encrypted

ges_metadata

ges_metadata object

Object for storing metadata message information.

Table 4 ges_metadata

Parameter

Type

Description

labels

Array of labels objects

Label data structure set

Table 5 labels

Parameter

Type

Description

name

String

Label name

properties

Array of Map<String,String> objects

Property map

Status code: 400

Table 6 Response body parameters

Parameter

Type

Description

error_code

String

System prompt code.

  • If execution succeeds, this parameter may be left blank.
  • If execution fails, this parameter is used to display the error code.

error_msg

String

System prompt code.

  • If execution succeeds, this parameter may be left blank.
  • If execution fails, this parameter is used to display the error message.

Example Request

Query metadata of a graph.

GET https://Endpoint/v2/{project_id}/graphs/metadatas/{metadata_id}

Example Response

Status code: 200

Example response for a successful request

{
  "encrypted" : false,
  "ges_metadata" : {
    "labels" : [ {
      "name" : "friends"
    }, {
      "name" : "movie",
      "properties" : [ {
        "data_type" : "string",
        "name" : "ChineseTitle",
        "cardinality" : "single"
      }, {
        "data_type" : "int",
        "name" : "Year",
        "cardinality" : "single"
      }, {
        "data_type" : "string",
        "name" : "Genres",
        "cardinality" : "set"
      } ]
    }, {
      "name" : "user",
      "properties" : [ {
        "data_type" : "string",
        "name" : "ChineseName",
        "cardinality" : "single"
      }, {
        "type_name1" : "F",
        "type_name2" : "M",
        "data_type" : "enum",
        "name" : "Gender",
        "type_name_count" : "2",
        "cardinality" : "single"
      }, {
        "type_name1" : "Under 18",
        "type_name2" : "18-24",
        "type_name3" : "25-34",
        "type_name4" : "35-44",
        "type_name5" : "45-49",
        "type_name6" : "50-55",
        "type_name7" : "56+",
        "data_type" : "enum",
        "name" : "Age",
        "type_name_count" : "7",
        "cardinality" : "single"
      }, {
        "data_type" : "string",
        "name" : "Occupation",
        "cardinality" : "single"
      }, {
        "data_type" : "char array",
        "name" : "Zip-code",
        "max_data_size" : "12",
        "cardinality" : "single"
      } ]
    }, {
      "name" : "rate",
      "properties" : [ {
        "data_type" : "int",
        "name" : "Score",
        "cardinality" : "single"
      }, {
        "data_type" : "date",
        "name" : "Datetime",
        "cardinality" : "single"
      } ]
    } ]
  }
}

Status code: 400

Example response for a failed request

{
  "error_msg" : "6b74069d-3cf3-4cc0-9118-2478e23b87a does not exist.",
  "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.