Updated on 2024-05-23 GMT+08:00

Creating a Graph (2.2.2)

Function

This API is used to create a graph.

URI

POST /v2/{project_id}/graphs

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.

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.

Table 3 Request body parameter

Parameter

Mandatory

Type

Description

graph

Yes

graph object

Graph type

Table 4 graph

Parameter

Mandatory

Type

Description

name

Yes

String

A graph name must start with a letter and contains 4 to 50 characters consisting of letters, digits, hyphens (-), and underscores (_). It cannot contain special characters.

graph_size_type_index

Yes

String

Graph size type index:

  • 0: Ten-thousand-edge
  • 1: Million-edge
  • 2: Ten-million-edge
  • 3: Hundred-million-edge
  • 4: Billion-edge
  • 5: Ten-billion-edge
  • 6: database edition
  • 401: Billion-edge-pro

arch

No

String

Graph instance's CPU architecture type. The value can be x86_64 or aarch64. The default value is x86_64.

  • x86_64: x86 64-bit architecture
  • aarch64: Arm 64-bit architecture

vpc_id

Yes

String

VPC ID

subnet_id

Yes

String

Subnet ID in the VPC

security_group_id

Yes

String

Security group ID

public_ip

No

public_ip object

Public IP address. If the parameter is not specified, public connection is not used by default.

enable_multi_az

No

Boolean

Whether the created graph supports the cross-AZ mode. The default value is false. If the value is true, the system will create the ECSs in the graph in two AZs.

If this parameter is not specified when you create a graph, all ECSs in the graph are created in one AZ.

encryption

No

encryption object

Whether to encrypt the graph instance. The graph instance is not encrypted by default.

lts_operation_trace

No

lts_operation_trace object

Whether to enable audit logs. This function is disabled by default.

sys_tags

No

Array of sys_tags objects

Enterprise project information. If this parameter is not specified, this function is disabled (default).

tags

No

Array of tags objects

TMS tags for expenses. This function is disabled by default.

enable_rbac

No

Boolean

Whether to enable granular permission control for the created graph. The default value is false, indicating that granular permission control is disabled. If this parameter is set to true, no user has the permission to access the graph. To access the graph, you need to call the granular permission control API of the service plane to set the required permissions.

enable_full_text_index

No

Boolean

Whether to enable full-text index control for the created graph. The default value is false, indicating that full-text index control is disabled. If this parameter is set to true, full-text indexes are available for Billion-edge-pro graphs, and a Cloud Search Service (CSS) cluster will be created when you create a graph.

NOTE:

If you enable full-text indexes: If the CSS has been deployed, the system automatically creates a CSS cluster during the creation of the graph instance, which will take a long time. If the CSS is not deployed, the graph creation will fail.

enable_hyg

No

Boolean

Whether to enable HyG for the graph. This parameter is available for database edition graphs only.

crypt_algorithm

Yes

String

Graph instance cryptography algorithm. Available values are as follows:

  • generalCipher: Chinese cryptographic algorithm
  • SMcompatible: Commercial cryptography algorithm (compatible with international ones)

enable_https

Yes

Boolean

Whether to enable the security mode. This mode may damage GES performance greatly.

product_type

No

String

Graph type. The value can be InMemory (default value) or Persistence. If graph_size_type_index is 6, the value must be Persistence.

  • InMemory: memory edition
  • Persistence: database version

vertex_id_type

No

vertex_id_type object

ID type of vertices. This parameter is mandatory only for database edition graphs.

NOTE:

The vertex ID type cannot be changed once set. Exercise caution when setting this parameter.

enable_multi_label

No

Boolean

Whether multi-lableing is enabled.

capacity_ratio

No

Integer

Capacity rate of a graph. This parameter is only available for Ten-billion-edge graphs of the database edition since version 2.3.18.

is_dynamic_graph

No

Boolean

Whether a graph is a dynamic one

Table 5 public_ip

Parameter

Mandatory

Type

Description

public_bind_type

No

String

Binding type of an EIP. The value can be either of the following:

  • auto_assign
  • bind_existing

eip_id

No

String

ID of an EIP. When publicBindType is set to bind_existing, its value is the ID of an EIP that has been created but has not been bound. When publicBindType is set to auto_assign, its value is set to null.

Table 6 encryption

Parameter

Mandatory

Type

Description

enable

No

Boolean

Whether to enable data encryption The value can be true or false. The default value is false.

master_key_id

No

String

ID of the customer master key created by DEW in the project corresponding to the graph creation

Table 7 lts_operation_trace

Parameter

Mandatory

Type

Description

enable_audit

No

Boolean

Whether to enable graph audit. The default value is false.

audit_log_group_name

No

String

LTS log group name

Table 8 sys_tags

Parameter

Mandatory

Type

Description

key

No

String

Key of the enterprise project. The value is _sys_enterprise_project_id.

value

No

String

Enterprise project ID. You can obtain it from the enterprise project.

Table 9 tags

Parameter

Mandatory

Type

Description

key

No

String

Tag key

value

No

String

Tag value

Table 10 vertex_id_type

Parameter

Mandatory

Type

Description

id_type

Yes

String

Vertex ID type. The value can be fixedLengthString or hash.

  • fixedLengthString: Vertex IDs are used for internal storage and compute. Specify the length limit. If the IDs are too long, the query performance can be reduced. Specify the length limit based on your dataset vertex IDs.
  • hash: Vertex IDs are converted into hash code for storage and compute. There is no limit on the ID length. However, there is an extremely low probability, approximately 10^(-43), that the vertex IDs will conflict. If you cannot determine the maximum length of a vertex ID, set this parameter to Hash.

id_length

No

Integer

This parameter is mandatory if id_type is fixedLengthString. The value ranges from 1 to 128.

Response Parameters

Status code: 200

Table 11 Response body parameters

Parameter

Type

Description

id

String

Graph ID

name

String

Graph name

Status code: 400

Table 12 Response body parameters

Parameter

Type

Description

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.

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.

Example Request

Create a graph. The graph name is demo, the graph size is Million-edge, the graph instance CPU architecture type is x86 64-bit, the VPC ID is 2d8af840-fd57-4e3b-a8f1-cda0f55ccd99, the subnet ID is dc018ec3-67d1-46c9-b2fc-19d83367f4e2, and the security group ID is 11d27338-8649-4076-8579-5ebc1a60f79e.

POST https://Endpoint/v2/{project_id}/graphs

{
  "graph" : {
    "name" : "demo",
    "graph_size_type_index" : "1",
    "arch" : "x86_64",
    "vpc_id" : "2d8af840-fd57-4e3b-a8f1-cda0f55ccd99",
    "subnet_id" : "dc018ec3-67d1-46c9-b2fc-19d83367f4e2",
    "security_group_id" : "11d27338-8649-4076-8579-5ebc1a60f79e",
    "public_ip" : {
      "public_bind_type" : "bind_existing",
      "eip_id" : "30ef2d58-08a9-4481-b526-b2cbe67d020d"
    },
    "enable_multi_az" : false,
    "encryption" : {
      "enable" : true,
      "master_key_id" : "b00b9356-73fb-4d49-8f79-f0a5da5354d1"
    },
    "lts_operation_trace" : {
      "enable_audit" : true,
      "audit_log_group_name" : "test"
    },
    "sys_tags" : [ {
      "key" : "_sys_enterprise_project_id",
      "value" : "54c0b33c-8627-462f-948e-bae08c0887b4"
    } ],
    "enable_rbac" : true,
    "enable_full_text_index" : true,
    "enable_hyg" : true,
    "crypt_algorithm" : "generalCipher",
    "enable_https" : false
  }
}

Example Response

Status code: 200

Example response for a successful request

{
  "id" : "f1529b88-c958-493e-8452-fccfe932cde1",
  "name" : "demo"
}

Status code: 400

Example response for a failed request

{
  "error_code" : "GES.7016",
  "error_msg" : "The parameter [subnetId] is not exist."
}

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

See Error Codes.