Skip to content
Permalink
Browse files
hugegraph-1371 add task, rebuild and async gremlin for tools doc and …
…api doc

Change-Id: I29096e3cabc119dbe31e092ebe207c338d795ce2
  • Loading branch information
zhoney committed Jul 30, 2018
1 parent 2d08fcf commit 21054f1c0181667fc7927f8cfd2e9ae850de2b11
Showing 10 changed files with 403 additions and 29 deletions.
@@ -33,6 +33,8 @@
* [Traverser](clients/restful-api/traverser.md)
* [Variable](clients/restful-api/variable.md)
* [Graph](clients/restful-api/graph.md)
* [Task](clients/restful-api/task.md)
* [Rebuild](clients/restful-api/rebuild.md)
* [Gremlin](clients/restful-api/gremlin.md)
* [Other](clients/restful-api/other.md)
* [Java Client](clients/hugegraph-client.md)
@@ -14,5 +14,6 @@ HugeGraph-Server通过HugeGraph-API基于HTTP协议为Client提供操作图的
- 遍历
- 变量
- 图操作
- 异步任务
- Gremlin
- 其他
@@ -242,6 +242,8 @@ http://localhost:8080/graphs/hugegraph/schema/edgelabels/created

#### 1.3.5 根据name删除EdgeLabel

删除 EdgeLabel 会导致删除对应的边以及相关的索引数据,会产生一个异步任务

##### Method

```
@@ -257,5 +259,17 @@ http://localhost:8080/graphs/hugegraph/schema/edgelabels/created
##### Response Status

```json
204
```
202
```

##### Response Body

```json
{
"task_id": 1
}
```

注:

> 可以通过`GET http://localhost:8080/graphs/hugegraph/tasks/1`(其中"1"是task_id)来查询异步任务的执行状态,更多[异步任务RESTful API](task.md)
@@ -1,6 +1,6 @@
### 6.1 Gremlin
### 7.1 Gremlin

#### 6.1.1 向HugeGraphServer发送gremlin语句(GET)
#### 7.1.1 向HugeGraphServer发送gremlin语句(GET),同步执行

##### Method

@@ -64,7 +64,7 @@ http://127.0.0.1:8080/gremlin?gremlin=hugegraph.traversal().V('1:marko')
}
```

#### 6.1.2 向HugeGraphServer发送gremlin语句(POST)
#### 7.1.2 向HugeGraphServer发送gremlin语句(POST),同步执行

##### Method

@@ -191,3 +191,84 @@ http://localhost:8080/gremlin
}
}
```

#### 7.1.3 向HugeGraphServer发送gremlin语句(POST),异步执行

##### Method

```
POST
```

##### Url

```
http://localhost:8080/graphs/hugegraph/jobs/gremlin
```

**查询顶点**

##### Request Body

```json
{
"gremlin": "g.V('1:marko')",
"bindings": {},
"language": "gremlin-groovy",
"aliases": {}
}
```

注意:

> 异步执行Gremlin语句暂不支持aliases,可以使用 `graph` 代表要操作的图,也可以直接使用图的名字, 例如 `hugegraph`;
另外`g`代表 traversal,等价于 `graph.traversal()` 或者 `hugegraph.traversal()`
##### Response Status

```json
200
```

##### Response Body

```json
{
"task_id": 1
}
```

注:

> 可以通过`GET http://localhost:8080/graphs/hugegraph/tasks/1`(其中"1"是task_id)来查询异步任务的执行状态,更多[异步任务RESTful API](task.md)
**查询边**

##### Request Body

```json
{
"gremlin": "g.E('S1:marko>2>>S2:lop')",
"bindings": {},
"language": "gremlin-groovy",
"aliases": {}
}
```

##### Response Status

```json
200
```

##### Response Body

```json
{
"task_id": 2
}
```

注:

> 可以通过`GET http://localhost:8080/graphs/hugegraph/tasks/2`(其中"2"是task_id)来查询异步任务的执行状态,更多[异步任务RESTful API](task.md)
@@ -158,6 +158,8 @@ http://localhost:8080/graphs/hugegraph/schema/indexlabels/personByCity

#### 1.4.4 根据name删除IndexLabel

删除 IndexLabel 会导致删除相关的索引数据,会产生一个异步任务

##### Method

```
@@ -173,5 +175,17 @@ http://localhost:8080/graphs/hugegraph/schema/indexlabels/personByCity
##### Response Status

```json
204
```
202
```

##### Response Body

```json
{
"task_id": 1
}
```

注:

> 可以通过`GET http://localhost:8080/graphs/hugegraph/tasks/1`(其中"1"是task_id)来查询异步任务的执行状态,更多[异步任务RESTful API](task.md)
@@ -1,6 +1,6 @@
### 7.1 Other
### 8.1 Other

#### 7.1.1 查看HugeGraph的版本信息
#### 8.1.1 查看HugeGraph的版本信息

##### Method

@@ -0,0 +1,97 @@
### 6.2 Rebuild

#### 6.2.1 重建IndexLabel

##### Method

```
PUT
```

##### Url

```
http://localhost:8080/graphs/hugegraph/jobs/rebuild/indexlabels/personByCity
```

##### Response Status

```json
202
```

##### Response Body

```json
{
"task_id": 1
}
```

注:

> 可以通过`GET http://localhost:8080/graphs/hugegraph/tasks/1`(其中"1"是task_id)来查询异步任务的执行状态,更多[异步任务RESTful API](task.md)
#### 6.2.2 重建VertexLabel索引

##### Method

```
PUT
```

##### Url

```
http://localhost:8080/graphs/hugegraph/jobs/rebuild/vertexlabels/person
```

##### Response Status

```json
202
```

##### Response Body

```json
{
"task_id": 2
}
```

注:

> 可以通过`GET http://localhost:8080/graphs/hugegraph/tasks/2`(其中"2"是task_id)来查询异步任务的执行状态,更多[异步任务RESTful API](task.md)
#### 6.2.3 重建EdgeLabel索引

##### Method

```
PUT
```

##### Url

```
http://localhost:8080/graphs/hugegraph/jobs/rebuild/edgelabels/softwareByPrice
```

##### Response Status

```json
202
```

##### Response Body

```json
{
"task_id": 3
}
```

注:

> 可以通过`GET http://localhost:8080/graphs/hugegraph/tasks/3`(其中"3"是task_id)来查询异步任务的执行状态,更多[异步任务RESTful API](task.md)
@@ -0,0 +1,104 @@
### 6.1 Task

#### 6.1.1 列出某个图中全部的异步任务

##### Method

```
GET
```

##### Params

- status: 异步任务的状态
- limit:返回异步任务数目上限

##### Url

```
http://localhost:8080/graphs/hugegraph/tasks?status=success
```

##### Response Status

```json
200
```

##### Response Body

```json
{
"tasks": [{
"task_name": "hugegraph.traversal().V()",
"task_progress": 0,
"task_create": 1532943976585,
"task_status": "success",
"task_update": 1532943976736,
"task_result": "0",
"task_retries": 0,
"id": 2,
"task_type": "gremlin",
"task_callable": "com.baidu.hugegraph.api.job.GremlinAPI$GremlinJob",
"task_input": "{\"gremlin\":\"hugegraph.traversal().V()\",\"bindings\":{},\"language\":\"gremlin-groovy\",\"aliases\":{\"hugegraph\":\"graph\"}}"
}]
}
```

#### 6.1.2 查看某个异步任务的信息

##### Method

```
GET
```

##### Url

```
http://localhost:8080/graphs/hugegraph/tasks/2
```

##### Response Status

```json
200
```

##### Response Body

```json
{
"task_name": "hugegraph.traversal().V()",
"task_progress": 0,
"task_create": 1532943976585,
"task_status": "success",
"task_update": 1532943976736,
"task_result": "0",
"task_retries": 0,
"id": 2,
"task_type": "gremlin",
"task_callable": "com.baidu.hugegraph.api.job.GremlinAPI$GremlinJob",
"task_input": "{\"gremlin\":\"hugegraph.traversal().V()\",\"bindings\":{},\"language\":\"gremlin-groovy\",\"aliases\":{\"hugegraph\":\"graph\"}}"
}
```

#### 6.1.3 删除某个异步任务信息,**不删除异步任务本身**

##### Method

```
DELETE
```

##### Url

```
http://localhost:8080/graphs/hugegraph/tasks/2
```

##### Response Status

```json
204
```

0 comments on commit 21054f1

Please sign in to comment.