graphscope.flex.rest.GraphApi¶
所有URI均相对于http://localhost
方法 |
HTTP请求 |
描述 |
|---|---|---|
POST /api/v1/graph/{graph_id}/schema/edge |
||
POST /api/v1/graph |
||
POST /api/v1/graph/{graph_id}/schema/vertex |
||
DELETE /api/v1/graph/{graph_id}/schema/edge/{type_name} |
||
DELETE /api/v1/graph/{graph_id} |
||
DELETE /api/v1/graph/{graph_id}/schema/vertex/{type_name} |
||
GET /api/v1/graph/{graph_id} |
||
GET /api/v1/graph/{graph_id}/schema |
||
POST /api/v1/graph/{graph_id}/schema |
||
GET /api/v1/graph |
create_edge_type¶
str create_edge_type(graph_id, create_edge_type=create_edge_type)
创建边类型
示例¶
import graphscope.flex.rest
from graphscope.flex.rest.models.create_edge_type import CreateEdgeType
from graphscope.flex.rest.rest import ApiException
from pprint import pprint
# Defining the host is optional and defaults to http://localhost
# See configuration.py for a list of all supported configuration parameters.
configuration = graphscope.flex.rest.Configuration(
host = "http://localhost"
)
# Enter a context with an instance of the API client
with graphscope.flex.rest.ApiClient(configuration) as api_client:
# Create an instance of the API class
api_instance = graphscope.flex.rest.GraphApi(api_client)
graph_id = 'graph_id_example' # str |
create_edge_type = graphscope.flex.rest.CreateEdgeType() # CreateEdgeType | (optional)
try:
api_response = api_instance.create_edge_type(graph_id, create_edge_type=create_edge_type)
print("The response of GraphApi->create_edge_type:\n")
pprint(api_response)
except Exception as e:
print("Exception when calling GraphApi->create_edge_type: %s\n" % e)
参数¶
名称 |
类型 |
描述 |
备注 |
|---|---|---|---|
graph_id |
str |
||
create_edge_type |
[可选] |
返回类型¶
str
HTTP请求头¶
内容类型: application/json
Accept: application/json
HTTP响应详情¶
状态码 |
描述 |
响应头 |
|---|---|---|
200 |
成功创建边类型 |
- |
400 |
错误请求 |
- |
500 |
服务器错误 |
- |
create_graph¶
CreateGraphResponse create_graph(create_graph_request)
创建新图
示例¶
import graphscope.flex.rest
from graphscope.flex.rest.models.create_graph_request import CreateGraphRequest
from graphscope.flex.rest.models.create_graph_response import CreateGraphResponse
from graphscope.flex.rest.rest import ApiException
from pprint import pprint
# Defining the host is optional and defaults to http://localhost
# See configuration.py for a list of all supported configuration parameters.
configuration = graphscope.flex.rest.Configuration(
host = "http://localhost"
)
# Enter a context with an instance of the API client
with graphscope.flex.rest.ApiClient(configuration) as api_client:
# Create an instance of the API class
api_instance = graphscope.flex.rest.GraphApi(api_client)
create_graph_request = graphscope.flex.rest.CreateGraphRequest() # CreateGraphRequest |
try:
api_response = api_instance.create_graph(create_graph_request)
print("The response of GraphApi->create_graph:\n")
pprint(api_response)
except Exception as e:
print("Exception when calling GraphApi->create_graph: %s\n" % e)
参数¶
名称 |
类型 |
描述 |
备注 |
|---|---|---|---|
create_graph_request |
返回类型¶
授权¶
无需授权
HTTP请求头¶
内容类型: application/json
Accept: application/json
HTTP响应详情¶
状态码 |
描述 |
响应头 |
|---|---|---|
200 |
图已创建 |
- |
400 |
错误请求 |
- |
500 |
服务器错误 |
- |
create_vertex_type¶
str create_vertex_type(graph_id, create_vertex_type)
创建顶点类型
示例¶
import graphscope.flex.rest
from graphscope.flex.rest.models.create_vertex_type import CreateVertexType
from graphscope.flex.rest.rest import ApiException
from pprint import pprint
# Defining the host is optional and defaults to http://localhost
# See configuration.py for a list of all supported configuration parameters.
configuration = graphscope.flex.rest.Configuration(
host = "http://localhost"
)
# Enter a context with an instance of the API client
with graphscope.flex.rest.ApiClient(configuration) as api_client:
# Create an instance of the API class
api_instance = graphscope.flex.rest.GraphApi(api_client)
graph_id = 'graph_id_example' # str |
create_vertex_type = graphscope.flex.rest.CreateVertexType() # CreateVertexType |
try:
api_response = api_instance.create_vertex_type(graph_id, create_vertex_type)
print("The response of GraphApi->create_vertex_type:\n")
pprint(api_response)
except Exception as e:
print("Exception when calling GraphApi->create_vertex_type: %s\n" % e)
参数¶
名称 |
类型 |
描述 |
备注 |
|---|---|---|---|
graph_id |
str |
||
create_vertex_type |
返回类型¶
str
授权¶
无需授权
HTTP请求头¶
内容类型: application/json
Accept: application/json
HTTP响应详情¶
状态码 |
描述 |
响应头 |
|---|---|---|
200 |
成功创建顶点类型 |
- |
400 |
错误请求 |
- |
500 |
服务器错误 |
- |
delete_edge_type_by_name¶
str delete_edge_type_by_name(graph_id, type_name, source_vertex_type, destination_vertex_type)
按名称删除边类型
示例¶
import graphscope.flex.rest
from graphscope.flex.rest.rest import ApiException
from pprint import pprint
# Defining the host is optional and defaults to http://localhost
# See configuration.py for a list of all supported configuration parameters.
configuration = graphscope.flex.rest.Configuration(
host = "http://localhost"
)
# Enter a context with an instance of the API client
with graphscope.flex.rest.ApiClient(configuration) as api_client:
# Create an instance of the API class
api_instance = graphscope.flex.rest.GraphApi(api_client)
graph_id = 'graph_id_example' # str |
type_name = 'type_name_example' # str |
source_vertex_type = 'source_vertex_type_example' # str |
destination_vertex_type = 'destination_vertex_type_example' # str |
try:
api_response = api_instance.delete_edge_type_by_name(graph_id, type_name, source_vertex_type, destination_vertex_type)
print("The response of GraphApi->delete_edge_type_by_name:\n")
pprint(api_response)
except Exception as e:
print("Exception when calling GraphApi->delete_edge_type_by_name: %s\n" % e)
参数¶
名称 |
类型 |
描述 |
备注 |
|---|---|---|---|
graph_id |
str |
||
type_name |
str |
||
source_vertex_type |
str |
||
destination_vertex_type |
str |
返回类型¶
str
授权¶
无需授权
HTTP请求头¶
Content-Type: 未定义
Accept: application/json
HTTP响应详情¶
状态码 |
描述 |
响应头 |
|---|---|---|
200 |
成功删除边类型 |
- |
500 |
服务器错误 |
- |
delete_graph_by_id¶
str delete_graph_by_id(graph_id)
按ID删除图
示例¶
import graphscope.flex.rest
from graphscope.flex.rest.rest import ApiException
from pprint import pprint
# Defining the host is optional and defaults to http://localhost
# See configuration.py for a list of all supported configuration parameters.
configuration = graphscope.flex.rest.Configuration(
host = "http://localhost"
)
# Enter a context with an instance of the API client
with graphscope.flex.rest.ApiClient(configuration) as api_client:
# Create an instance of the API class
api_instance = graphscope.flex.rest.GraphApi(api_client)
graph_id = 'graph_id_example' # str |
try:
api_response = api_instance.delete_graph_by_id(graph_id)
print("The response of GraphApi->delete_graph_by_id:\n")
pprint(api_response)
except Exception as e:
print("Exception when calling GraphApi->delete_graph_by_id: %s\n" % e)
参数¶
名称 |
类型 |
描述 |
备注 |
|---|---|---|---|
graph_id |
str |
返回类型¶
str
授权¶
无需授权
HTTP请求头¶
Content-Type: 未定义
Accept: application/json
HTTP响应详情¶
状态码 |
描述 |
响应头 |
|---|---|---|
200 |
成功删除图数据 |
- |
500 |
服务器错误 |
- |
delete_vertex_type_by_name¶
str delete_vertex_type_by_name(graph_id, type_name)
根据名称删除顶点类型
示例¶
import graphscope.flex.rest
from graphscope.flex.rest.rest import ApiException
from pprint import pprint
# Defining the host is optional and defaults to http://localhost
# See configuration.py for a list of all supported configuration parameters.
configuration = graphscope.flex.rest.Configuration(
host = "http://localhost"
)
# Enter a context with an instance of the API client
with graphscope.flex.rest.ApiClient(configuration) as api_client:
# Create an instance of the API class
api_instance = graphscope.flex.rest.GraphApi(api_client)
graph_id = 'graph_id_example' # str |
type_name = 'type_name_example' # str |
try:
api_response = api_instance.delete_vertex_type_by_name(graph_id, type_name)
print("The response of GraphApi->delete_vertex_type_by_name:\n")
pprint(api_response)
except Exception as e:
print("Exception when calling GraphApi->delete_vertex_type_by_name: %s\n" % e)
参数¶
名称 |
类型 |
描述 |
备注 |
|---|---|---|---|
graph_id |
str |
||
type_name |
str |
返回类型¶
str
授权¶
无需授权
HTTP请求头¶
Content-Type: 未定义
Accept: application/json
HTTP响应详情¶
状态码 |
描述 |
响应头 |
|---|---|---|
200 |
成功删除顶点类型 |
- |
500 |
服务器错误 |
- |
get_graph_by_id¶
GetGraphResponse 通过ID获取图(graph_id)
通过ID获取图
示例¶
import graphscope.flex.rest
from graphscope.flex.rest.models.get_graph_response import GetGraphResponse
from graphscope.flex.rest.rest import ApiException
from pprint import pprint
# Defining the host is optional and defaults to http://localhost
# See configuration.py for a list of all supported configuration parameters.
configuration = graphscope.flex.rest.Configuration(
host = "http://localhost"
)
# Enter a context with an instance of the API client
with graphscope.flex.rest.ApiClient(configuration) as api_client:
# Create an instance of the API class
api_instance = graphscope.flex.rest.GraphApi(api_client)
graph_id = 'graph_id_example' # str |
try:
api_response = api_instance.get_graph_by_id(graph_id)
print("The response of GraphApi->get_graph_by_id:\n")
pprint(api_response)
except Exception as e:
print("Exception when calling GraphApi->get_graph_by_id: %s\n" % e)
参数¶
名称 |
类型 |
描述 |
备注 |
|---|---|---|---|
graph_id |
str |
返回类型¶
授权¶
无需授权
HTTP请求头¶
Content-Type: 未定义
Accept: application/json
HTTP响应详情¶
状态码 |
描述 |
响应头 |
|---|---|---|
200 |
成功返回图数据 |
- |
500 |
服务器错误 |
- |
get_schema_by_id¶
get_schema_by_id(graph_id) 获取指定图ID的图模式响应
通过ID获取图模式
示例¶
import graphscope.flex.rest
from graphscope.flex.rest.models.get_graph_schema_response import GetGraphSchemaResponse
from graphscope.flex.rest.rest import ApiException
from pprint import pprint
# Defining the host is optional and defaults to http://localhost
# See configuration.py for a list of all supported configuration parameters.
configuration = graphscope.flex.rest.Configuration(
host = "http://localhost"
)
# Enter a context with an instance of the API client
with graphscope.flex.rest.ApiClient(configuration) as api_client:
# Create an instance of the API class
api_instance = graphscope.flex.rest.GraphApi(api_client)
graph_id = 'graph_id_example' # str |
try:
api_response = api_instance.get_schema_by_id(graph_id)
print("The response of GraphApi->get_schema_by_id:\n")
pprint(api_response)
except Exception as e:
print("Exception when calling GraphApi->get_schema_by_id: %s\n" % e)
参数¶
名称 |
类型 |
描述 |
备注 |
|---|---|---|---|
graph_id |
str |
返回类型¶
授权¶
无需授权
HTTP请求头¶
Content-Type: 未定义
Accept: application/json
HTTP响应详情¶
状态码 |
描述 |
响应头 |
|---|---|---|
200 |
成功返回图模式 |
- |
500 |
服务器错误 |
- |
import_schema_by_id¶
str import_schema_by_id(graph_id, create_graph_schema_request)
导入图模式
示例¶
import graphscope.flex.rest
from graphscope.flex.rest.models.create_graph_schema_request import CreateGraphSchemaRequest
from graphscope.flex.rest.rest import ApiException
from pprint import pprint
# Defining the host is optional and defaults to http://localhost
# See configuration.py for a list of all supported configuration parameters.
configuration = graphscope.flex.rest.Configuration(
host = "http://localhost"
)
# Enter a context with an instance of the API client
with graphscope.flex.rest.ApiClient(configuration) as api_client:
# Create an instance of the API class
api_instance = graphscope.flex.rest.GraphApi(api_client)
graph_id = 'graph_id_example' # str |
create_graph_schema_request = graphscope.flex.rest.CreateGraphSchemaRequest() # CreateGraphSchemaRequest |
try:
api_response = api_instance.import_schema_by_id(graph_id, create_graph_schema_request)
print("The response of GraphApi->import_schema_by_id:\n")
pprint(api_response)
except Exception as e:
print("Exception when calling GraphApi->import_schema_by_id: %s\n" % e)
参数¶
名称 |
类型 |
描述 |
备注 |
|---|---|---|---|
graph_id |
str |
||
创建图模式请求 |
返回类型¶
str
授权¶
无需授权
HTTP请求头¶
内容类型: application/json
Accept: application/json
HTTP响应详情¶
状态码 |
描述 |
响应头 |
|---|---|---|
200 |
成功导入图模式 |
- |
400 |
错误请求 |
- |
500 |
服务器错误 |
- |
list_graphs¶
List[GetGraphResponse] list_graphs()
列出所有图
示例¶
import graphscope.flex.rest
from graphscope.flex.rest.models.get_graph_response import GetGraphResponse
from graphscope.flex.rest.rest import ApiException
from pprint import pprint
# Defining the host is optional and defaults to http://localhost
# See configuration.py for a list of all supported configuration parameters.
configuration = graphscope.flex.rest.Configuration(
host = "http://localhost"
)
# Enter a context with an instance of the API client
with graphscope.flex.rest.ApiClient(configuration) as api_client:
# Create an instance of the API class
api_instance = graphscope.flex.rest.GraphApi(api_client)
try:
api_response = api_instance.list_graphs()
print("The response of GraphApi->list_graphs:\n")
pprint(api_response)
except Exception as e:
print("Exception when calling GraphApi->list_graphs: %s\n" % e)
参数¶
此端点不需要任何参数。
返回类型¶
授权¶
无需授权
HTTP请求头¶
Content-Type: 未定义
Accept: application/json
HTTP响应详情¶
状态码 |
描述 |
响应头 |
|---|---|---|
200 |
成功返回所有图数据 |
- |
500 |
服务器错误 |
- |