EdgeApi

All URIs are relative to {INTERACTIVE_ADMIN_ENDPOINT}

Method

HTTP request

Description

add_edge

POST /v1/graph/{graph_id}/edge

Add edge to the graph

get_edge

GET /v1/graph/{graph_id}/edge

Get the edge’s properties with src and dst vertex primary keys.

update_edge

PUT /v1/graph/{graph_id}/edge

Update edge’s property

add_edge

Result[str] add_edge(graph_id, edge_request)

Add a edge to the graph.

Example

from gs_interactive.client.driver import Driver
from gs_interactive.client.session import Session
from gs_interactive.models import *

driver = Driver()
sess = driver.session()

graph_id = "1"

edge_request = [
    EdgeRequest(
        src_label="person",
        dst_label="person",
        edge_label="knows",
        src_primary_key_value=2,
        dst_primary_key_value=4,
        properties=[ModelProperty(name="weight", value=9.123)],
    ),
    EdgeRequest(
        src_label="person",
        dst_label="person",
        edge_label="knows",
        src_primary_key_value=2,
        dst_primary_key_value=6,
        properties=[ModelProperty(name="weight", value=3.233)],
    ),
]
resp = sess.add_edge(graph_id, edge_request)
print(resp)
assert resp.is_ok()

Parameters

Name

Type

Description

Notes

graph_id

str

edge_request

List[EdgeRequest]

Return type

str

Authorization

No authorization required

HTTP request headers

  • Content-Type: application/json

  • Accept: application/json

HTTP response details

Status code

Description

Response headers

200

Successfully insert the edge

-

400

Invalid input edge

-

409

edge already exists

-

500

Server internal error

-

[Back to top] [Back to API list] [Back to Model list] [Back to python_sdk]

get_edge

Result[EdgeData] get_edge(graph_id, edge_label, src_label, src_primary_key_value, dst_label, dst_primary_key_value)

Get the edge’s properties with src and dst vertex primary keys.

Get the properties for the specified vertex.

Example

from gs_interactive.client.driver import Driver
from gs_interactive.client.session import Session
from gs_interactive.models import *

driver = Driver()
sess = driver.session()

graph_id = "1"

resp = sess.get_edge(graph_id, "knows", "person", 2, "person", 4)
assert resp.is_ok()
for k, v in resp.get_value().properties:
    if k == "weight":
        assert v == 9.123
print(resp)
assert resp.is_ok()

Parameters

Name

Type

Description

Notes

graph_id

str

edge_label

str

The label name of querying edge.

src_label

str

The label name of src vertex.

src_primary_key_value

object

The primary key value of src vertex.

dst_label

str

The label name of dst vertex.

dst_primary_key_value

object

The value of dst vertex’s primary key

Return type

EdgeData

Authorization

No authorization required

HTTP request headers

  • Content-Type: Not defined

  • Accept: application/json

HTTP response details

Status code

Description

Response headers

200

Found Edge

-

400

Bad input parameter

-

404

Edge not found or Graph not found

-

500

Server internal error

-

[Back to top] [Back to API list] [Back to Model list] [Back to python_sdk]

update_edge

Result[str] update_edge(graph_id, edge_request=edge_request)

Update edge’s property

Update the edge on the running graph.

Example

from gs_interactive.client.driver import Driver
from gs_interactive.client.session import Session
from gs_interactive.models import *

driver = Driver()
sess = driver.session()

graph_id = "1"

resp = sess.update_edge(
    graph_id,
    EdgeRequest(
        src_label="person",
        dst_label="person",
        edge_label="knows",
        src_primary_key_value=2,
        dst_primary_key_value=4,
        properties=[ModelProperty(name="weight", value=3)],
    ),
)
print(resp)
assert resp.is_ok()

Parameters

Name

Type

Description

Notes

graph_id

str

edge_request

EdgeRequest

[optional]

Return type

str

Authorization

No authorization required

HTTP request headers

  • Content-Type: application/json

  • Accept: application/json

HTTP response details

Status code

Description

Response headers

200

Successfully update edge

-

400

Invalid input parameters

-

404

Edge not exists

-

500

Server internal error

-

[Back to top] [Back to API list] [Back to Model list] [Back to python_sdk]