Updated on 2022-02-22 GMT+08:00

Deleting Vertices and Edges by Files

Function

This API is used to delete vertices and edges by reading the files.

URL

  • URI format
    POST  /v1.0/{project_id}/graphs/{graph_name}/action?action_id=delete-by-file
  • Parameters
    Table 1 URI parameter description

    Parameter

    Mandatory

    Type

    Description

    project_id

    Yes

    String

    Project ID, which is used for resource isolation. For details, see Obtaining a Project ID.

    graph_name

    Yes

    String

    Graph name

Request

  • Request example
POST http://Endpoint/v1.0/{project_id}/graphs/{graph_name}/action?action_id=delete-by-file
{
  "vertexsetPath": "datasets/movie/movie.csv",
  "vertexsetFormat": "csv",
  "edgesetPath": "datasets/movie/ranking_edge.csv",
  "edgesetFormat": "csv",
  "targetProperties": [
    {
      "label": "rate",
      "properties": [
        "Rating"
      ]
    }
  ],
  "delimiter": ",",
  "trimQuote": "\"",
  "obsParameters": {
  "accessKey": "XXXXXXX",
  "secretKey": "XXXXXXX"
  }
}
  • Parameters
    Table 2 Request body parameter description

    Parameter

    Mandatory

    Type

    Description

    vertexsetPath

    Either vertexsetPath or edgesetPath is mandatory.

    String

    Vertex file directory or name

    vertexsetFormat

    No

    String

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

    The CSV format is used by default.

    edgesetPath

    Either vertexsetPath or edgesetPath is mandatory.

    String

    Edge file directory or name

    edgesetFormat

    No

    String

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

    The CSV format is used by default.

    targetProperties

    No

    Json

    Indicates property information used to distinguish duplicate edges in the edge file, in JSONArray format. For details, see Table 3.

    delimiter

    No

    Character

    Field separator in a CSV file. The default value is comma (,). The default element separator in a field of the list/set type is semicolon (;).

    trimQuote

    No

    Character

    Field quote character in a CSV file. The default value is double quotation marks ("). They are used to enclose a field if the field contains separators or line breaks.

    obsParameters

    Yes

    String

    OBS authentication parameters. For details, see Table 3.

    Table 3 targetProperties parameter description

    Parameter

    Mandatory

    Type

    Description

    label

    Yes

    String

    Name of a label

    properties

    Yes

    Json

    Edge ID properties, in JSONArray format. Currently, only one property is supported.

    The format of the CSV file for updating properties is as follows:

    • Vertex file: Vertex ID
    • Edge file (excluding the label): source vertex ID and destination vertex ID
    • Edge file (including the label): source vertex ID, destination vertex ID, label, and edge ID

Response

  • Parameter description

    Parameter

    Mandatory

    Type

    Description

    errorMessage

    No

    String

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

    errorCode

    No

    String

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

    job_id

    No

    String

    ID of an asynchronous job

    You can view the job execution status and obtain the return result by querying the job ID. For details, see Querying Job Status on the Service Plane.

  • Response example (successful request)
    Http Status Code: 200
    {
      "jobId": "b4f2e9a0-0439-4edd-a3ad-199bb523b613"
    }
  • Response example (failed request)
    Http Status Code: 400
    {
      "errorMessage": "parameter format error",
      "errorCode": "GES.8013"
    }

Return Value

  • Normal

200

  • Abnormal
Table 4 Return code for failed requests

Return Value

Description

400 Bad Request

Request error.

401 Unauthorized

Authentication failed.

403 Forbidden

No operation permission.

404 Not Found

The requested resource was not found.

500 Internal Server Error

Internal service error.

503 Service Unavailable

Service unavailable.