Updated on 2024-12-03 GMT+08:00

Creating a Graph (2.2.2)

Function

This API is used to create a graph.

URI

POST /v1.0/{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.

graphSizeTypeIndex

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

vpcId

Yes

String

VPC ID

subnetId

Yes

String

Subnet ID in the VPC

securityGroupId

Yes

String

Security group ID

publicIp

No

publicIp object

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

enableMultiAz

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

encryptionReq object

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

ltsOperationTrace

No

ltsOperationTraceReq object

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

sys_tags

No

Array of SysTagsRes objects

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

tags

No

Array of SysTagsRes objects

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

enableRBAC

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.

enableFullTextIndex

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.

enableHyG

No

Boolean

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

cryptAlgorithm

Yes

String

Graph instance cryptography algorithm. Available values are as follows:

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

enableHttps

Yes

Boolean

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

tags

No

JsonArray

Tag list. Each tag is in <key,value> format.

Table 5 parameters

Parameter

Mandatory

Type

Description

schemaPath

Yes

String

OBS path for storing the metadata file. Only files are supported.

edgesetPath

Yes

String

OBS path for storing the edge file. Only files are supported.

edgesetFormat

No

String

Format of the edge data set. Currently, only the CSV format is supported.

The CSV format is used by default.

edgesetDefaultLabel

No

String

Default label of an edge data set. This parameter is left blank by default.

vertexsetPath

No

String

OBS path for storing the vertex file. Only files are supported.

vertexsetFormat

No

String

Format of the vertex data set. Currently, only the CSV format is supported.

The CSV format is used by default.

vertexsetDefaultLabel

No

String

Default label of a vertex data set. This parameter is left blank by default.

logDir

No

String

OBS log storage directory. This directory stores the data that fails to be imported during graph creation and detailed logs.

parallelEdge

No

parallelEdge object

How to process repetitive edges.

  • For details about the value validity of the schemaPath, edgesetPath, vertexsetPath, and logDir character strings, see the OBS Object Name Restrictions.
Table 6 parallelEdge

Parameter

Mandatory

Type

Description

action

No

String

Processing mode of repetitive edges. The value can be allow, ignore, or override. The default value is allow.

  • allow indicates that repetitive edges are allowed.
  • ignore indicates that subsequent repetitive edges are ignored.
  • override indicates that the previous repetitive edges are overwritten.

ignoreLabel

No

Boolean

Whether to ignore labels on repetitive edges. The value can be true or false. The default value is true.

  • true: Indicates that the repetitive edge definition does not contain the label. That is, the <source vertex, target vertex> indicates an edge, excluding the label information.
  • false: Indicates that the repetitive edge definition contains the label. That is, the <source vertex, target vertex, label> indicates an edge.
Table 7 publicIp

Parameter

Mandatory

Type

Description

publicBindType

No

String

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

  • auto_assign
  • bind_existing

eipId

No

String

EIP ID

  • If publicBindType is bind_existing, the value is the ID of a created EIP that has not been bound.
  • If publicBindType is auto_assign, leave this parameter blank.
Table 8 encryptionReq

Parameter

Mandatory

Type

Description

enable

No

Boolean

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

masterKeyId

No

String

ID of the user master key created by the Data Encryption Workshop (DEW) on HUAWEI CLOUD in the project where the graph is created.

Table 9 ltsOperationTraceReq

Parameter

Mandatory

Type

Description

enableAudit

No

Boolean

Whether to enable graph audit. The value can be true or false. The default value is false.

auditLogGroupName

No

String

LTS log group name

Table 10 SysTagsRes

Parameter

Mandatory

Type

Description

key

No

String

Key of the enterprise project. Set this parameter to _sys_enterprise_project_id.

value

No

String

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

Response Parameters

Status code: 200

Table 11 Response body parameters

Parameter

Type

Description

id

String

Graph ID

name

String

Graph name

errorMessage

String

System prompt.

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

errorCode

String

System prompt.

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

Example Request

POST https://Endpoint/v1.0/{project_id}/graphs
{
    "graph":{
        "name":"demo",
        "graphSizeTypeIndex": "1",
        "arch":"x86_64",
        "vpcId":"2d8af840-fd57-4e3b-a8f1-cda0f55ccd99",
        "subnetId":"dc018ec3-67d1-46c9-b2fc-19d83367f4e2",
        "securityGroupId":"11d27338-8649-4076-8579-5ebc1a60f79e",
        "publicIp":{
           "publicBindType":"bind_existing",
           "eipId":"30ef2d58-08a9-4481-b526-b2cbe67d020d"
        },
        "enableMultiAz":false,
        "sys_tags": [{"key": "_sys_enterprise_project_id",                        "value": "54c0b33c-8627-462f-948e-bae08c0887b4"}],
	"encryption":{
           "enable":true,
           "masterKeyId":"b00b9356-73fb-4d49-8f79-f0a5da5354d1"
        },
        "enableRBAC":false,
        "enableFullTextIndex" : false, 
        "cryptAlgorithm": "generalCipher",
        "enableHttps": "false"
    }
}

Example Response

Status code: 200

OK

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

Status Codes

Status Codes

Description

200

Request sent.

400

Request error.

401

Authorization failed.

403

No operation permissions.

404

No resources found.

500

Internal server error.

503

Service unavailable.