semvec/pypi-packages huggingface dataset:
gshttpservice 0.1.0
Http server wrapper for standalone GraphScope
License: Apache License 2.0
Keywords: GraphScope,Graph Computations

# Install
-------------

```shell
$ python3 setup.py bdist_wheel
$ cd dist && pip3 install ./*.whl
```

# Launch http service
--------------------------------

```shell
$ python3 -m gshttpservice 9527
```

# API
## Create instance
---------------------------
**POST   /api/graphservice/createInstance**
```
> body
> {
>    "num_workers": 2,
>    "vineyard_shared_mem": "4Gi"
> }
```
**See more  parameter details from [Doc](https://graphscope.io/docs/reference/session.html)**

## Get instance
------------------------
**GET  /api/graphservice/getInstance**


## Load data
-------------------
**POST  /api/graphservice/loadData**

```
> body
> {
>    "type": "LOCAL",
>    "directed": true,
>    "oid_type": "string",
>    "instance_id": "<graphscope instance id>",
>    "dataSource": {
>        "nodes": [
>            {
>                "label": "v",
>                "location": "",
>                "config": {
>                    "header_row": true,
>                    "delimiter": ","
>                }
>            }
>        ],
>        "edges": [
>            {
>                "label": "e",
>                "location": "",
>                "srcLabel": "v",
>                "dstLabel": "v",
>                "config": {
>                    "header_row": true,
>                    "delimiter": ","
>                }
>            }
>        ]
>    }
>}
```

## Get graph schema
--------------------------------
**GET  /api/graphservice/graphSchema**

```
> params
> {
>     "graph_name": ""
> }
```


## Gremlin query
--------------------------
**GET  /api/graphservice/query/gremlin**


```
> params
> {
>    "graph_name": <graph for gremlin query>,
>    "gremlinSQL": "g.V('1')"
> }
```

## Close instance
----------------
**GET /api/graphservice/closeInstance**

```
> params
> {
>     "instance_id": <graphscope instance to close>,
> }
```

## Upload file
-------------
**POST /api/graphservice/uploadFile**

```
> header
> {
>   Content-Type: multipart/form-data
> }
>
> body
> {
>   file=@file_path,
>   instance_id="instance_id"
> }

> example
> curl -i -X POST -H "Content-Type: multipart/form-data" -F "file=@file1" -F "file=@file2" -F "instance_id=xxx" -w %{http_code} http://localhost:9527/api/graphservice/uploadFile
```