This is an automated email from the ASF dual-hosted git repository.

jin pushed a commit to branch master
in repository 
https://gitbox.apache.org/repos/asf/incubator-hugegraph-toolchain.git


The following commit(s) were added to refs/heads/master by this push:
     new 43da581b feat(client): support graphspace (#633)
43da581b is described below

commit 43da581b7512212d5e11e5a470d2763c063f7135
Author: John <[email protected]>
AuthorDate: Mon Feb 24 16:18:46 2025 +0800

    feat(client): support graphspace (#633)
    
    * add todo about be compatitable to server do not support gs
    
    ---------
    
    Co-authored-by: imbajin <[email protected]>
---
 .github/workflows/client-ci.yml                    |   2 +
 .../main/java/org/apache/hugegraph/api/API.java    |  24 +-
 .../org/apache/hugegraph/api/graph/EdgeAPI.java    |   4 +-
 .../org/apache/hugegraph/api/graph/GraphAPI.java   |  14 +-
 .../org/apache/hugegraph/api/graph/VertexAPI.java  |  14 +-
 .../org/apache/hugegraph/api/graphs/GraphsAPI.java |  21 +-
 .../apache/hugegraph/api/gremlin/CypherAPI.java    |  11 +-
 .../apache/hugegraph/api/gremlin/GremlinAPI.java   |   4 +
 .../job/{GremlinJobAPI.java => CypherJobAPI.java}  |  13 +-
 .../apache/hugegraph/api/job/GremlinJobAPI.java    |   4 +-
 .../java/org/apache/hugegraph/api/job/JobAPI.java  |   6 +-
 .../org/apache/hugegraph/api/job/RebuildAPI.java   |   4 +-
 .../apache/hugegraph/api/schema/EdgeLabelAPI.java  |   4 +-
 .../apache/hugegraph/api/schema/IndexLabelAPI.java |   4 +-
 .../hugegraph/api/schema/PropertyKeyAPI.java       |   4 +-
 .../org/apache/hugegraph/api/schema/SchemaAPI.java |   6 +-
 .../hugegraph/api/schema/SchemaElementAPI.java     |   6 +-
 .../hugegraph/api/schema/VertexLabelAPI.java       |   4 +-
 .../VariablesAPI.java => space/ConfigAPI.java}     |  51 +--
 .../apache/hugegraph/api/space/GraphSpaceAPI.java  | 153 +++++++++
 .../VersionAPI.java => space/HStoreAPI.java}       |  43 ++-
 .../{version/VersionAPI.java => space/PDAPI.java}  |  18 +-
 .../SchemaTemplateAPI.java}                        |  45 +--
 .../org/apache/hugegraph/api/space/ServiceAPI.java |  84 +++++
 .../ServiceOptionAPI.java}                         |  19 +-
 .../org/apache/hugegraph/api/task/TaskAPI.java     |  32 +-
 .../hugegraph/api/variables/VariablesAPI.java      |   8 +-
 .../apache/hugegraph/api/version/VersionAPI.java   |   2 +-
 .../org/apache/hugegraph/client/RestClient.java    |  94 +++++-
 .../org/apache/hugegraph/driver/CypherManager.java |  25 +-
 .../org/apache/hugegraph/driver/GraphManager.java  |  12 +-
 .../apache/hugegraph/driver/GraphSpaceManager.java | 100 ++++++
 .../org/apache/hugegraph/driver/GraphsManager.java |   4 +-
 .../apache/hugegraph/driver/GremlinManager.java    |  29 +-
 .../org/apache/hugegraph/driver/HugeClient.java    |  77 ++++-
 .../apache/hugegraph/driver/HugeClientBuilder.java |  33 +-
 .../org/apache/hugegraph/driver/JobManager.java    |   6 +-
 .../org/apache/hugegraph/driver/SchemaManager.java |  14 +-
 .../org/apache/hugegraph/driver/TaskManager.java   |   6 +-
 .../apache/hugegraph/driver/VariablesManager.java  |  10 +-
 .../driver/factory/DefaultHugeClientFactory.java   |  63 ++++
 .../org/apache/hugegraph/example/BatchExample.java |   5 +-
 .../org/apache/hugegraph/example/MovieExample.java |   5 +-
 .../apache/hugegraph/example/SingleExample.java    |  15 +-
 .../serializer/direct/reuse/BytesDemo.java         |   2 +-
 .../hugegraph/structure/constant/HugeType.java     |  54 +++-
 .../hugegraph/structure/space/GraphSpace.java      | 360 +++++++++++++++++++++
 .../hugegraph/structure/space/HStoreNodeInfo.java  | 117 +++++++
 .../hugegraph/structure/space/OLTPService.java     | 241 ++++++++++++++
 .../space/OLTPServiceConfig.java}                  |  36 ++-
 .../space/PDNodeInfo.java}                         |  49 ++-
 .../hugegraph/structure/space/SchemaTemplate.java  | 110 +++++++
 .../space/StorageService.java}                     |  17 +-
 .../java/org/apache/hugegraph/BaseClientTest.java  |   9 +-
 .../java/org/apache/hugegraph/api/BaseApiTest.java |  35 +-
 .../org/apache/hugegraph/api/GraphsApiTest.java    | 122 +++----
 .../org/apache/hugegraph/api/VertexApiTest.java    |  10 +-
 .../hugegraph/functional/HugeClientHttpsTest.java  |  22 +-
 .../hugegraph/functional/HugeClientTest.java       |   3 +-
 59 files changed, 1923 insertions(+), 366 deletions(-)

diff --git a/.github/workflows/client-ci.yml b/.github/workflows/client-ci.yml
index 1efe9b75..3f24c938 100644
--- a/.github/workflows/client-ci.yml
+++ b/.github/workflows/client-ci.yml
@@ -55,6 +55,8 @@ jobs:
 
       - name: Prepare env and service
         run: |
+          # TODO(@Thespica): test both servers of supporting gs and not 
supporting gs
+          #                  when the server supports gs
           $TRAVIS_DIR/install-hugegraph-from-source.sh $COMMIT_ID
 
       - name: Install Java ${{ matrix.JAVA_VERSION }} for client
diff --git a/hugegraph-client/src/main/java/org/apache/hugegraph/api/API.java 
b/hugegraph-client/src/main/java/org/apache/hugegraph/api/API.java
index 1f9d5025..24d48a3c 100644
--- a/hugegraph-client/src/main/java/org/apache/hugegraph/api/API.java
+++ b/hugegraph-client/src/main/java/org/apache/hugegraph/api/API.java
@@ -37,6 +37,20 @@ public abstract class API {
         this.path = null;
     }
 
+    protected static void checkOffset(long value) {
+        E.checkArgument(value >= 0, "Offset must be >= 0, but got: %s", value);
+    }
+
+    protected static void checkLimit(long value, String name) {
+        E.checkArgument(value > 0 || value == NO_LIMIT,
+                        "%s must be > 0 or == %s, but got: %s",
+                        name, NO_LIMIT, value);
+    }
+
+    protected static String joinPath(String... paths) {
+        return String.join(PATH_SPLITOR, paths);
+    }
+
     public String path() {
         E.checkState(this.path != null, "Path can't be null");
         return this.path;
@@ -51,14 +65,4 @@ public abstract class API {
     }
 
     protected abstract String type();
-
-    protected static void checkOffset(long value) {
-        E.checkArgument(value >= 0, "Offset must be >= 0, but got: %s", value);
-    }
-
-    protected static void checkLimit(long value, String name) {
-        E.checkArgument(value > 0 || value == NO_LIMIT,
-                        "%s must be > 0 or == %s, but got: %s",
-                        name, NO_LIMIT, value);
-    }
 }
diff --git 
a/hugegraph-client/src/main/java/org/apache/hugegraph/api/graph/EdgeAPI.java 
b/hugegraph-client/src/main/java/org/apache/hugegraph/api/graph/EdgeAPI.java
index 36c3eb19..64f02593 100644
--- a/hugegraph-client/src/main/java/org/apache/hugegraph/api/graph/EdgeAPI.java
+++ b/hugegraph-client/src/main/java/org/apache/hugegraph/api/graph/EdgeAPI.java
@@ -35,8 +35,8 @@ import com.google.common.collect.ImmutableMap;
 
 public class EdgeAPI extends GraphAPI {
 
-    public EdgeAPI(RestClient client, String graph) {
-        super(client, graph);
+    public EdgeAPI(RestClient client, String graphSpace, String graph) {
+        super(client, graphSpace, graph);
     }
 
     @Override
diff --git 
a/hugegraph-client/src/main/java/org/apache/hugegraph/api/graph/GraphAPI.java 
b/hugegraph-client/src/main/java/org/apache/hugegraph/api/graph/GraphAPI.java
index c2eb7681..b47a9ad5 100644
--- 
a/hugegraph-client/src/main/java/org/apache/hugegraph/api/graph/GraphAPI.java
+++ 
b/hugegraph-client/src/main/java/org/apache/hugegraph/api/graph/GraphAPI.java
@@ -27,20 +27,16 @@ import org.apache.hugegraph.util.JsonUtil;
 
 public abstract class GraphAPI extends API {
 
-    private static final String PATH = "graphs/%s/graph/%s";
+    private static final String PATH = "graphspaces/%s/graphs/%s/graph/%s";
 
     private final String batchPath;
 
-    public GraphAPI(RestClient client, String graph) {
+    public GraphAPI(RestClient client, String graphSpace, String graph) {
         super(client);
-        this.path(PATH, graph, this.type());
+        this.path(PATH, graphSpace, graph, this.type());
         this.batchPath = String.join("/", this.path(), "batch");
     }
 
-    public String batchPath() {
-        return this.batchPath;
-    }
-
     public static String formatVertexId(Object id) {
         return formatVertexId(id, false);
     }
@@ -68,4 +64,8 @@ public abstract class GraphAPI extends API {
         }
         return JsonUtil.toJson(properties);
     }
+
+    public String batchPath() {
+        return this.batchPath;
+    }
 }
diff --git 
a/hugegraph-client/src/main/java/org/apache/hugegraph/api/graph/VertexAPI.java 
b/hugegraph-client/src/main/java/org/apache/hugegraph/api/graph/VertexAPI.java
index 70f4de78..734757bb 100644
--- 
a/hugegraph-client/src/main/java/org/apache/hugegraph/api/graph/VertexAPI.java
+++ 
b/hugegraph-client/src/main/java/org/apache/hugegraph/api/graph/VertexAPI.java
@@ -36,8 +36,8 @@ import com.google.common.collect.ImmutableMap;
 
 public class VertexAPI extends GraphAPI {
 
-    public VertexAPI(RestClient client, String graph) {
-        super(client, graph);
+    public VertexAPI(RestClient client, String graphSpace, String graph) {
+        super(client, graphSpace, graph);
     }
 
     @Override
@@ -83,21 +83,21 @@ public class VertexAPI extends GraphAPI {
     }
 
     public Vertex append(Vertex vertex) {
-        String id = formatVertexId(vertex.id());
+        String id = GraphAPI.formatVertexId(vertex.id());
         Map<String, Object> params = ImmutableMap.of("action", "append");
         RestResult result = this.client.put(this.path(), id, vertex, params);
         return result.readObject(Vertex.class);
     }
 
     public Vertex eliminate(Vertex vertex) {
-        String id = formatVertexId(vertex.id());
+        String id = GraphAPI.formatVertexId(vertex.id());
         Map<String, Object> params = ImmutableMap.of("action", "eliminate");
         RestResult result = this.client.put(this.path(), id, vertex, params);
         return result.readObject(Vertex.class);
     }
 
     public Vertex get(Object id) {
-        String vertexId = formatVertexId(id);
+        String vertexId = GraphAPI.formatVertexId(id);
         RestResult result = this.client.get(this.path(), vertexId);
         return result.readObject(Vertex.class);
     }
@@ -115,7 +115,7 @@ public class VertexAPI extends GraphAPI {
                          boolean keepP, int offset, String page, int limit) {
         checkOffset(offset);
         checkLimit(limit, "Limit");
-        String props = formatProperties(properties);
+        String props = GraphAPI.formatProperties(properties);
         Map<String, Object> params = new LinkedHashMap<>();
         params.put("label", label);
         params.put("properties", props);
@@ -128,7 +128,7 @@ public class VertexAPI extends GraphAPI {
     }
 
     public void delete(Object id) {
-        String vertexId = formatVertexId(id);
+        String vertexId = GraphAPI.formatVertexId(id);
         this.client.delete(this.path(), vertexId);
     }
 }
diff --git 
a/hugegraph-client/src/main/java/org/apache/hugegraph/api/graphs/GraphsAPI.java 
b/hugegraph-client/src/main/java/org/apache/hugegraph/api/graphs/GraphsAPI.java
index 8310e44f..1abf54b7 100644
--- 
a/hugegraph-client/src/main/java/org/apache/hugegraph/api/graphs/GraphsAPI.java
+++ 
b/hugegraph-client/src/main/java/org/apache/hugegraph/api/graphs/GraphsAPI.java
@@ -39,10 +39,19 @@ public class GraphsAPI extends API {
     private static final String GRAPH_READ_MODE = "graph_read_mode";
     private static final String CLEAR = "clear";
     private static final String CONFIRM_MESSAGE = "confirm_message";
+    private static final String PATH = "graphspaces/%s/graphs";
 
-    public GraphsAPI(RestClient client) {
+    public GraphsAPI(RestClient client, String graphSpace) {
         super(client);
-        this.path(this.type());
+        this.path(String.format(PATH, graphSpace));
+    }
+
+    private static String joinPath(String path, String graph) {
+        return String.join(DELIMITER, path, graph);
+    }
+
+    private static String joinPath(String path, String graph, String action) {
+        return String.join(DELIMITER, path, graph, action);
     }
 
     @Override
@@ -130,12 +139,4 @@ public class GraphsAPI extends API {
             throw new InvalidResponseException("Invalid GraphReadMode value 
'%s'", value);
         }
     }
-
-    private static String joinPath(String path, String graph) {
-        return String.join(DELIMITER, path, graph);
-    }
-
-    private static String joinPath(String path, String graph, String action) {
-        return String.join(DELIMITER, path, graph, action);
-    }
 }
diff --git 
a/hugegraph-client/src/main/java/org/apache/hugegraph/api/gremlin/CypherAPI.java
 
b/hugegraph-client/src/main/java/org/apache/hugegraph/api/gremlin/CypherAPI.java
index 63cf438b..0d9ea5f9 100644
--- 
a/hugegraph-client/src/main/java/org/apache/hugegraph/api/gremlin/CypherAPI.java
+++ 
b/hugegraph-client/src/main/java/org/apache/hugegraph/api/gremlin/CypherAPI.java
@@ -20,24 +20,23 @@ package org.apache.hugegraph.api.gremlin;
 import org.apache.hugegraph.api.API;
 import org.apache.hugegraph.client.RestClient;
 import org.apache.hugegraph.rest.RestResult;
-import org.apache.hugegraph.structure.constant.HugeType;
 import org.apache.hugegraph.structure.gremlin.Response;
 
 public class CypherAPI extends API {
 
-    private static final String PATH = "graphs/%s/cypher";
+    private static final String PATH = "graphspaces/%s/graphs/%s/cypher";
 
-    public CypherAPI(RestClient client, String graph) {
+    public CypherAPI(RestClient client) {
         super(client);
-        this.path(PATH, graph);
     }
 
     @Override
     protected String type() {
-        return HugeType.CYPHER.string();
+        return PATH;
     }
 
-    public Response post(String cypher) {
+    public Response post(String graphSpace, String graph, String cypher) {
+        this.path(type(), graphSpace, graph);
         RestResult result = this.client.post(this.path(), cypher);
         return result.readObject(Response.class);
     }
diff --git 
a/hugegraph-client/src/main/java/org/apache/hugegraph/api/gremlin/GremlinAPI.java
 
b/hugegraph-client/src/main/java/org/apache/hugegraph/api/gremlin/GremlinAPI.java
index 31795d19..9cb652e4 100644
--- 
a/hugegraph-client/src/main/java/org/apache/hugegraph/api/gremlin/GremlinAPI.java
+++ 
b/hugegraph-client/src/main/java/org/apache/hugegraph/api/gremlin/GremlinAPI.java
@@ -39,4 +39,8 @@ public class GremlinAPI extends API {
         RestResult result = this.client.post(this.path(), request);
         return result.readObject(Response.class);
     }
+
+    public boolean isSupportGs() {
+        return client.isSupportGs();
+    }
 }
diff --git 
a/hugegraph-client/src/main/java/org/apache/hugegraph/api/job/GremlinJobAPI.java
 b/hugegraph-client/src/main/java/org/apache/hugegraph/api/job/CypherJobAPI.java
similarity index 77%
copy from 
hugegraph-client/src/main/java/org/apache/hugegraph/api/job/GremlinJobAPI.java
copy to 
hugegraph-client/src/main/java/org/apache/hugegraph/api/job/CypherJobAPI.java
index 36bb720b..e4163ff5 100644
--- 
a/hugegraph-client/src/main/java/org/apache/hugegraph/api/job/GremlinJobAPI.java
+++ 
b/hugegraph-client/src/main/java/org/apache/hugegraph/api/job/CypherJobAPI.java
@@ -19,17 +19,16 @@ package org.apache.hugegraph.api.job;
 
 import java.util.Map;
 
-import org.apache.hugegraph.api.gremlin.GremlinRequest;
 import org.apache.hugegraph.api.task.TaskAPI;
 import org.apache.hugegraph.client.RestClient;
 import org.apache.hugegraph.rest.RestResult;
 
-public class GremlinJobAPI extends JobAPI {
+public class CypherJobAPI extends JobAPI {
 
-    private static final String JOB_TYPE = "gremlin";
+    private static final String JOB_TYPE = "cypher";
 
-    public GremlinJobAPI(RestClient client, String graph) {
-        super(client, graph);
+    public CypherJobAPI(RestClient client, String graphSpace, String graph) {
+        super(client, graphSpace, graph);
     }
 
     @Override
@@ -37,8 +36,8 @@ public class GremlinJobAPI extends JobAPI {
         return JOB_TYPE;
     }
 
-    public long execute(GremlinRequest request) {
-        RestResult result = this.client.post(this.path(), request);
+    public long execute(String cypher) {
+        RestResult result = this.client.post(this.path(), cypher);
         @SuppressWarnings("unchecked")
         Map<String, Object> task = result.readObject(Map.class);
         return TaskAPI.parseTaskId(task);
diff --git 
a/hugegraph-client/src/main/java/org/apache/hugegraph/api/job/GremlinJobAPI.java
 
b/hugegraph-client/src/main/java/org/apache/hugegraph/api/job/GremlinJobAPI.java
index 36bb720b..5119e411 100644
--- 
a/hugegraph-client/src/main/java/org/apache/hugegraph/api/job/GremlinJobAPI.java
+++ 
b/hugegraph-client/src/main/java/org/apache/hugegraph/api/job/GremlinJobAPI.java
@@ -28,8 +28,8 @@ public class GremlinJobAPI extends JobAPI {
 
     private static final String JOB_TYPE = "gremlin";
 
-    public GremlinJobAPI(RestClient client, String graph) {
-        super(client, graph);
+    public GremlinJobAPI(RestClient client, String graphSpace, String graph) {
+        super(client, graphSpace, graph);
     }
 
     @Override
diff --git 
a/hugegraph-client/src/main/java/org/apache/hugegraph/api/job/JobAPI.java 
b/hugegraph-client/src/main/java/org/apache/hugegraph/api/job/JobAPI.java
index da2300ac..d4d7e9d8 100644
--- a/hugegraph-client/src/main/java/org/apache/hugegraph/api/job/JobAPI.java
+++ b/hugegraph-client/src/main/java/org/apache/hugegraph/api/job/JobAPI.java
@@ -24,11 +24,11 @@ import org.apache.hugegraph.structure.constant.HugeType;
 public abstract class JobAPI extends API {
 
     // For example: graphs/hugegraph/jobs/gremlin
-    private static final String PATH = "graphs/%s/%s/%s";
+    private static final String PATH = "graphspaces/%s/graphs/%s/%s/%s";
 
-    public JobAPI(RestClient client, String graph) {
+    public JobAPI(RestClient client, String graphSpace, String graph) {
         super(client);
-        this.path(String.format(PATH, graph, this.type(), this.jobType()));
+        this.path(String.format(PATH, graphSpace, graph, this.type(), 
this.jobType()));
     }
 
     @Override
diff --git 
a/hugegraph-client/src/main/java/org/apache/hugegraph/api/job/RebuildAPI.java 
b/hugegraph-client/src/main/java/org/apache/hugegraph/api/job/RebuildAPI.java
index d3ea915b..49d8f870 100644
--- 
a/hugegraph-client/src/main/java/org/apache/hugegraph/api/job/RebuildAPI.java
+++ 
b/hugegraph-client/src/main/java/org/apache/hugegraph/api/job/RebuildAPI.java
@@ -32,8 +32,8 @@ public class RebuildAPI extends JobAPI {
 
     private static final String JOB_TYPE = "rebuild";
 
-    public RebuildAPI(RestClient client, String graph) {
-        super(client, graph);
+    public RebuildAPI(RestClient client, String graphSpace, String graph) {
+        super(client, graphSpace, graph);
     }
 
     @Override
diff --git 
a/hugegraph-client/src/main/java/org/apache/hugegraph/api/schema/EdgeLabelAPI.java
 
b/hugegraph-client/src/main/java/org/apache/hugegraph/api/schema/EdgeLabelAPI.java
index 08efe67a..cc6f2ddc 100644
--- 
a/hugegraph-client/src/main/java/org/apache/hugegraph/api/schema/EdgeLabelAPI.java
+++ 
b/hugegraph-client/src/main/java/org/apache/hugegraph/api/schema/EdgeLabelAPI.java
@@ -32,8 +32,8 @@ import com.google.common.collect.ImmutableMap;
 
 public class EdgeLabelAPI extends SchemaElementAPI {
 
-    public EdgeLabelAPI(RestClient client, String graph) {
-        super(client, graph);
+    public EdgeLabelAPI(RestClient client, String graphSpace, String graph) {
+        super(client, graphSpace, graph);
     }
 
     @Override
diff --git 
a/hugegraph-client/src/main/java/org/apache/hugegraph/api/schema/IndexLabelAPI.java
 
b/hugegraph-client/src/main/java/org/apache/hugegraph/api/schema/IndexLabelAPI.java
index aa8d08b7..b8b24884 100644
--- 
a/hugegraph-client/src/main/java/org/apache/hugegraph/api/schema/IndexLabelAPI.java
+++ 
b/hugegraph-client/src/main/java/org/apache/hugegraph/api/schema/IndexLabelAPI.java
@@ -34,8 +34,8 @@ import com.google.common.collect.ImmutableMap;
 
 public class IndexLabelAPI extends SchemaElementAPI {
 
-    public IndexLabelAPI(RestClient client, String graph) {
-        super(client, graph);
+    public IndexLabelAPI(RestClient client, String graphSpace, String graph) {
+        super(client, graphSpace, graph);
     }
 
     @Override
diff --git 
a/hugegraph-client/src/main/java/org/apache/hugegraph/api/schema/PropertyKeyAPI.java
 
b/hugegraph-client/src/main/java/org/apache/hugegraph/api/schema/PropertyKeyAPI.java
index 11b3546b..414e8979 100644
--- 
a/hugegraph-client/src/main/java/org/apache/hugegraph/api/schema/PropertyKeyAPI.java
+++ 
b/hugegraph-client/src/main/java/org/apache/hugegraph/api/schema/PropertyKeyAPI.java
@@ -34,8 +34,8 @@ import com.google.common.collect.ImmutableMap;
 
 public class PropertyKeyAPI extends SchemaElementAPI {
 
-    public PropertyKeyAPI(RestClient client, String graph) {
-        super(client, graph);
+    public PropertyKeyAPI(RestClient client, String graphSpace, String graph) {
+        super(client, graphSpace, graph);
     }
 
     @Override
diff --git 
a/hugegraph-client/src/main/java/org/apache/hugegraph/api/schema/SchemaAPI.java 
b/hugegraph-client/src/main/java/org/apache/hugegraph/api/schema/SchemaAPI.java
index 5b114aa3..078b7bce 100644
--- 
a/hugegraph-client/src/main/java/org/apache/hugegraph/api/schema/SchemaAPI.java
+++ 
b/hugegraph-client/src/main/java/org/apache/hugegraph/api/schema/SchemaAPI.java
@@ -28,11 +28,11 @@ import org.apache.hugegraph.structure.SchemaElement;
 
 public class SchemaAPI extends API {
 
-    private static final String PATH = "graphs/%s/%s";
+    private static final String PATH = "graphspaces/%s/graphs/%s/%s";
 
-    public SchemaAPI(RestClient client, String graph) {
+    public SchemaAPI(RestClient client, String graphSpace, String graph) {
         super(client);
-        this.path(PATH, graph, this.type());
+        this.path(PATH, graphSpace, graph, this.type());
     }
 
     @SuppressWarnings("unchecked")
diff --git 
a/hugegraph-client/src/main/java/org/apache/hugegraph/api/schema/SchemaElementAPI.java
 
b/hugegraph-client/src/main/java/org/apache/hugegraph/api/schema/SchemaElementAPI.java
index 41729447..9e8936ee 100644
--- 
a/hugegraph-client/src/main/java/org/apache/hugegraph/api/schema/SchemaElementAPI.java
+++ 
b/hugegraph-client/src/main/java/org/apache/hugegraph/api/schema/SchemaElementAPI.java
@@ -23,11 +23,11 @@ import org.apache.hugegraph.structure.SchemaElement;
 
 public abstract class SchemaElementAPI extends API {
 
-    private static final String PATH = "graphs/%s/schema/%s";
+    private static final String PATH = "graphspaces/%s/graphs/%s/schema/%s";
 
-    public SchemaElementAPI(RestClient client, String graph) {
+    public SchemaElementAPI(RestClient client, String graphSpace, String 
graph) {
         super(client);
-        this.path(PATH, graph, this.type());
+        this.path(PATH, graphSpace, graph, this.type());
     }
 
     protected abstract Object checkCreateOrUpdate(SchemaElement schemaElement);
diff --git 
a/hugegraph-client/src/main/java/org/apache/hugegraph/api/schema/VertexLabelAPI.java
 
b/hugegraph-client/src/main/java/org/apache/hugegraph/api/schema/VertexLabelAPI.java
index 79d2477c..22eb4cc0 100644
--- 
a/hugegraph-client/src/main/java/org/apache/hugegraph/api/schema/VertexLabelAPI.java
+++ 
b/hugegraph-client/src/main/java/org/apache/hugegraph/api/schema/VertexLabelAPI.java
@@ -32,8 +32,8 @@ import com.google.common.collect.ImmutableMap;
 
 public class VertexLabelAPI extends SchemaElementAPI {
 
-    public VertexLabelAPI(RestClient client, String graph) {
-        super(client, graph);
+    public VertexLabelAPI(RestClient client, String graphSpace, String graph) {
+        super(client, graphSpace, graph);
     }
 
     @Override
diff --git 
a/hugegraph-client/src/main/java/org/apache/hugegraph/api/variables/VariablesAPI.java
 b/hugegraph-client/src/main/java/org/apache/hugegraph/api/space/ConfigAPI.java
similarity index 51%
copy from 
hugegraph-client/src/main/java/org/apache/hugegraph/api/variables/VariablesAPI.java
copy to 
hugegraph-client/src/main/java/org/apache/hugegraph/api/space/ConfigAPI.java
index 016be729..efb4ed5f 100644
--- 
a/hugegraph-client/src/main/java/org/apache/hugegraph/api/variables/VariablesAPI.java
+++ 
b/hugegraph-client/src/main/java/org/apache/hugegraph/api/space/ConfigAPI.java
@@ -15,51 +15,60 @@
  * under the License.
  */
 
-package org.apache.hugegraph.api.variables;
+package org.apache.hugegraph.api.space;
 
-import java.util.Map;
+import com.google.common.collect.ImmutableMap;
 
 import org.apache.hugegraph.api.API;
 import org.apache.hugegraph.client.RestClient;
 import org.apache.hugegraph.rest.RestResult;
 import org.apache.hugegraph.structure.constant.HugeType;
 
-import com.google.common.collect.ImmutableMap;
+import java.util.List;
+import java.util.Map;
 
-public class VariablesAPI extends API {
+public class ConfigAPI extends API {
 
-    private static final String PATH = "graphs/%s/%s";
+    private static final String PATH = "graphspaces/%s/configs/rest";
 
-    public VariablesAPI(RestClient client, String graph) {
+    public ConfigAPI(RestClient client, String graphSpace) {
         super(client);
-        this.path(PATH, graph, this.type());
+        this.path(String.format(PATH, graphSpace));
     }
 
     @Override
     protected String type() {
-        return HugeType.VARIABLES.string();
+        return HugeType.CONFIGS.string();
     }
 
-    @SuppressWarnings("unchecked")
-    public Map<String, Object> get(String key) {
-        RestResult result = this.client.get(path(), key);
-        return result.readObject(Map.class);
+    public List<String> listConfigOptions() {
+        RestResult result = client.get(this.path(), "config-fields");
+        return result.readList("fields", String.class);
     }
 
-    @SuppressWarnings("unchecked")
-    public Map<String, Object> set(String key, Object value) {
-        value = ImmutableMap.of("data", value);
-        RestResult result = this.client.put(this.path(), key, value);
+    public Map<String, Object> get(String serviceName) {
+        RestResult result = client.get(this.path(), serviceName);
+
         return result.readObject(Map.class);
     }
 
-    public void remove(String key) {
-        this.client.delete(path(), key);
+    public Map<String, Object> add(String serviceName,
+                                   Map<String, Object> configs) {
+        ImmutableMap<String, Object> data
+                = ImmutableMap.of("name", serviceName, "config", configs);
+        RestResult result = client.post(this.path(), data);
+
+        return result.readObject(Map.class);
     }
 
-    @SuppressWarnings("unchecked")
-    public Map<String, Object> all() {
-        RestResult result = this.client.get(path());
+    public Map<String, Object> update(String serviceName,
+                                      Map<String, Object> config) {
+        RestResult result = client.put(this.path(), serviceName, config);
+
         return result.readObject(Map.class);
     }
+
+    public void delete(String serviceName) {
+        client.delete(this.path(), serviceName);
+    }
 }
diff --git 
a/hugegraph-client/src/main/java/org/apache/hugegraph/api/space/GraphSpaceAPI.java
 
b/hugegraph-client/src/main/java/org/apache/hugegraph/api/space/GraphSpaceAPI.java
new file mode 100644
index 00000000..b04408fd
--- /dev/null
+++ 
b/hugegraph-client/src/main/java/org/apache/hugegraph/api/space/GraphSpaceAPI.java
@@ -0,0 +1,153 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with this
+ * work for additional information regarding copyright ownership. The ASF
+ * licenses this file to You under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.hugegraph.api.space;
+
+import com.google.common.collect.ImmutableMap;
+
+import org.apache.commons.lang.StringUtils;
+import org.apache.hugegraph.api.API;
+import org.apache.hugegraph.client.RestClient;
+import org.apache.hugegraph.rest.RestResult;
+import org.apache.hugegraph.structure.constant.HugeType;
+import org.apache.hugegraph.structure.space.GraphSpace;
+import org.apache.hugegraph.util.JsonUtil;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.LinkedHashMap;
+import java.util.List;
+import java.util.Map;
+
+public class GraphSpaceAPI extends API {
+
+    private static final String PATH = "graphspaces";
+    private static final String DELIMITER = "/";
+
+    public GraphSpaceAPI(RestClient client) {
+        super(client);
+        this.path(PATH);
+    }
+
+    private static String joinPath(String path, String id) {
+        return String.join(DELIMITER, path, id);
+    }
+
+    @Override
+    protected String type() {
+        return HugeType.GRAPHSPACES.string();
+    }
+
+    public GraphSpace create(GraphSpace graphSpace) {
+        this.client.checkApiVersion("0.67", "dynamic graph space add");
+        Object obj = graphSpace.convertReq();
+        RestResult result = this.client.post(this.path(), obj);
+        return result.readObject(GraphSpace.class);
+    }
+
+    public GraphSpace get(String name) {
+        RestResult result = this.client.get(this.path(), name);
+        return result.readObject(GraphSpace.class);
+    }
+
+    public List<String> list() {
+        RestResult result = this.client.get(this.path());
+
+        return result.readList(this.type(), String.class);
+    }
+
+    public List<Map<String, Object>> listProfile(String prefix) {
+        String profilePath = joinPath(this.path(), "profile");
+        Map<String, Object> params = new LinkedHashMap<>();
+        params.put("prefix", prefix);
+        RestResult result = this.client.get(profilePath, params);
+        List<Map> results = result.readList(Map.class);
+        List<Map<String, Object>> profiles = new ArrayList<>();
+        for (Object entry : results) {
+            profiles.add(JsonUtil.fromJson(JsonUtil.toJson(entry), Map.class));
+        }
+        return profiles;
+    }
+
+    public Map<String, String> setDefault(String name) {
+        String defaultPath = joinPath(this.path(), name, "default");
+        RestResult result = this.client.get(defaultPath);
+        return result.readObject(Map.class);
+    }
+
+    public Map<String, String> getDefault() {
+        String defaultPath = joinPath(this.path(), "default");
+        RestResult result = this.client.get(defaultPath);
+        return result.readObject(Map.class);
+    }
+
+    public Map<String, String> setDefaultRole(String name, String user,
+                                              String role, String graph) {
+        String path = joinPath(this.path(), name, "role");
+        Map<String, Object> params = new HashMap<>();
+        params.put("user", user);
+        params.put("role", role);
+        if (StringUtils.isNotEmpty(graph)) {
+            params.put("graph", graph);
+        }
+        RestResult result = this.client.post(path, params);
+        return result.readObject(Map.class);
+    }
+
+    public boolean checkDefaultRole(String name, String user,
+                                    String role, String graph) {
+        String path = joinPath(this.path(), name, "role");
+        Map<String, Object> params = new HashMap<>();
+        params.put("user", user);
+        params.put("role", role);
+        if (StringUtils.isNotEmpty(graph)) {
+            params.put("graph", graph);
+        }
+        RestResult result = this.client.get(path, params);
+        return (boolean) result.readObject(Map.class).getOrDefault("check",
+                                                                   false);
+    }
+
+    public Map<String, String> deleteDefaultRole(String name, String user,
+                                                 String role, String graph) {
+        String path = joinPath(this.path(), name, "role");
+        Map<String, Object> params = new HashMap<>();
+        params.put("user", user);
+        params.put("role", role);
+        if (StringUtils.isNotEmpty(graph)) {
+            params.put("graph", graph);
+        }
+        RestResult result = this.client.delete(path, params);
+        return result.readObject(Map.class);
+    }
+
+    public void delete(String name) {
+        this.client.delete(joinPath(this.path(), name),
+                           ImmutableMap.of());
+    }
+
+    public GraphSpace update(GraphSpace graphSpace) {
+        Object obj = graphSpace.convertReq();
+        RestResult result = this.client.put(this.path(),
+                                            graphSpace.getName(),
+                                            ImmutableMap.of("action", "update",
+                                                            "update",
+                                                            obj));
+
+        return result.readObject(GraphSpace.class);
+    }
+}
diff --git 
a/hugegraph-client/src/main/java/org/apache/hugegraph/api/version/VersionAPI.java
 b/hugegraph-client/src/main/java/org/apache/hugegraph/api/space/HStoreAPI.java
similarity index 50%
copy from 
hugegraph-client/src/main/java/org/apache/hugegraph/api/version/VersionAPI.java
copy to 
hugegraph-client/src/main/java/org/apache/hugegraph/api/space/HStoreAPI.java
index 2071a341..b43da323 100644
--- 
a/hugegraph-client/src/main/java/org/apache/hugegraph/api/version/VersionAPI.java
+++ 
b/hugegraph-client/src/main/java/org/apache/hugegraph/api/space/HStoreAPI.java
@@ -15,28 +15,57 @@
  * under the License.
  */
 
-package org.apache.hugegraph.api.version;
+package org.apache.hugegraph.api.space;
 
 import org.apache.hugegraph.api.API;
 import org.apache.hugegraph.client.RestClient;
 import org.apache.hugegraph.rest.RestResult;
 import org.apache.hugegraph.structure.constant.HugeType;
-import org.apache.hugegraph.structure.version.Versions;
+import org.apache.hugegraph.structure.space.HStoreNodeInfo;
 
-public class VersionAPI extends API {
+import java.util.List;
+import java.util.Map;
 
-    public VersionAPI(RestClient client) {
+public class HStoreAPI extends API {
+
+    private static final String PATH = "hstore";
+
+    public HStoreAPI(RestClient client) {
         super(client);
         this.path(this.type());
     }
 
     @Override
     protected String type() {
-        return HugeType.VERSION.string();
+        return HugeType.HSTORE.string();
     }
 
-    public Versions get() {
+    public List<String> list() {
         RestResult result = this.client.get(this.path());
-        return result.readObject(Versions.class);
+        return result.readList("nodes", String.class);
+    }
+
+    public HStoreNodeInfo get(String id) {
+        RestResult result = this.client.get(this.path(), id);
+        return result.readObject(HStoreNodeInfo.class);
+    }
+
+    public String status() {
+        RestResult result = this.client.get(this.path(), "status");
+        return (String) result.readObject(Map.class).get("status");
+    }
+
+    public void startSplit() {
+        this.client.get(this.path(), "split");
+    }
+
+    public void nodeStartup(String id) {
+        String startupPath = joinPath(this.path(), id, "startup");
+        this.client.get(startupPath);
+    }
+
+    public void nodeShutdown(String id) {
+        String startupPath = joinPath(this.path(), id, "shutdown");
+        this.client.get(startupPath);
     }
 }
diff --git 
a/hugegraph-client/src/main/java/org/apache/hugegraph/api/version/VersionAPI.java
 b/hugegraph-client/src/main/java/org/apache/hugegraph/api/space/PDAPI.java
similarity index 75%
copy from 
hugegraph-client/src/main/java/org/apache/hugegraph/api/version/VersionAPI.java
copy to hugegraph-client/src/main/java/org/apache/hugegraph/api/space/PDAPI.java
index 2071a341..66be9440 100644
--- 
a/hugegraph-client/src/main/java/org/apache/hugegraph/api/version/VersionAPI.java
+++ b/hugegraph-client/src/main/java/org/apache/hugegraph/api/space/PDAPI.java
@@ -15,28 +15,32 @@
  * under the License.
  */
 
-package org.apache.hugegraph.api.version;
+package org.apache.hugegraph.api.space;
 
 import org.apache.hugegraph.api.API;
 import org.apache.hugegraph.client.RestClient;
 import org.apache.hugegraph.rest.RestResult;
 import org.apache.hugegraph.structure.constant.HugeType;
-import org.apache.hugegraph.structure.version.Versions;
+import org.apache.hugegraph.structure.space.PDNodeInfo;
 
-public class VersionAPI extends API {
+import java.util.List;
 
-    public VersionAPI(RestClient client) {
+public class PDAPI extends API {
+
+    private static final String PATH = "pd";
+
+    public PDAPI(RestClient client) {
         super(client);
         this.path(this.type());
     }
 
     @Override
     protected String type() {
-        return HugeType.VERSION.string();
+        return HugeType.PD.string();
     }
 
-    public Versions get() {
+    public List<PDNodeInfo> list() {
         RestResult result = this.client.get(this.path());
-        return result.readObject(Versions.class);
+        return result.readList("members", PDNodeInfo.class);
     }
 }
diff --git 
a/hugegraph-client/src/main/java/org/apache/hugegraph/api/variables/VariablesAPI.java
 
b/hugegraph-client/src/main/java/org/apache/hugegraph/api/space/SchemaTemplateAPI.java
similarity index 54%
copy from 
hugegraph-client/src/main/java/org/apache/hugegraph/api/variables/VariablesAPI.java
copy to 
hugegraph-client/src/main/java/org/apache/hugegraph/api/space/SchemaTemplateAPI.java
index 016be729..700b8ea6 100644
--- 
a/hugegraph-client/src/main/java/org/apache/hugegraph/api/variables/VariablesAPI.java
+++ 
b/hugegraph-client/src/main/java/org/apache/hugegraph/api/space/SchemaTemplateAPI.java
@@ -15,51 +15,54 @@
  * under the License.
  */
 
-package org.apache.hugegraph.api.variables;
-
-import java.util.Map;
+package org.apache.hugegraph.api.space;
 
 import org.apache.hugegraph.api.API;
 import org.apache.hugegraph.client.RestClient;
 import org.apache.hugegraph.rest.RestResult;
 import org.apache.hugegraph.structure.constant.HugeType;
+import org.apache.hugegraph.structure.space.SchemaTemplate;
 
-import com.google.common.collect.ImmutableMap;
+import java.util.List;
+import java.util.Map;
 
-public class VariablesAPI extends API {
+public class SchemaTemplateAPI extends API {
 
-    private static final String PATH = "graphs/%s/%s";
+    private static final String PATH = "graphspaces/%s/schematemplates";
 
-    public VariablesAPI(RestClient client, String graph) {
+    public SchemaTemplateAPI(RestClient client, String graphSpace) {
         super(client);
-        this.path(PATH, graph, this.type());
+        this.path(String.format(PATH, graphSpace));
     }
 
     @Override
     protected String type() {
-        return HugeType.VARIABLES.string();
+        return HugeType.SCHEMATEMPLATES.string();
     }
 
-    @SuppressWarnings("unchecked")
-    public Map<String, Object> get(String key) {
-        RestResult result = this.client.get(path(), key);
+    public Map create(SchemaTemplate template) {
+        RestResult result = this.client.post(this.path(), template);
         return result.readObject(Map.class);
     }
 
-    @SuppressWarnings("unchecked")
-    public Map<String, Object> set(String key, Object value) {
-        value = ImmutableMap.of("data", value);
-        RestResult result = this.client.put(this.path(), key, value);
+    public List<String> list() {
+        RestResult result = this.client.get(this.path());
+        return result.readList(this.type(), String.class);
+    }
+
+    public Map get(String name) {
+        RestResult result = this.client.get(this.path(), name);
         return result.readObject(Map.class);
     }
 
-    public void remove(String key) {
-        this.client.delete(path(), key);
+    public void delete(String name) {
+        this.client.delete(this.path(), name);
     }
 
-    @SuppressWarnings("unchecked")
-    public Map<String, Object> all() {
-        RestResult result = this.client.get(path());
+    public Map update(SchemaTemplate template) {
+        RestResult result = this.client.put(this.path(), template.name(),
+                                            template);
+
         return result.readObject(Map.class);
     }
 }
diff --git 
a/hugegraph-client/src/main/java/org/apache/hugegraph/api/space/ServiceAPI.java 
b/hugegraph-client/src/main/java/org/apache/hugegraph/api/space/ServiceAPI.java
new file mode 100644
index 00000000..9355a2e2
--- /dev/null
+++ 
b/hugegraph-client/src/main/java/org/apache/hugegraph/api/space/ServiceAPI.java
@@ -0,0 +1,84 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with this
+ * work for additional information regarding copyright ownership. The ASF
+ * licenses this file to You under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.hugegraph.api.space;
+
+import com.google.common.collect.ImmutableMap;
+
+import org.apache.hugegraph.api.API;
+import org.apache.hugegraph.client.RestClient;
+import org.apache.hugegraph.rest.RestResult;
+import org.apache.hugegraph.structure.constant.HugeType;
+import org.apache.hugegraph.structure.space.OLTPService;
+
+import java.util.List;
+import java.util.Map;
+
+public class ServiceAPI extends API {
+
+    private static final String PATH = "graphspaces/%s/services";
+    private static final String CONFIRM_MESSAGE = "confirm_message";
+    private static final String DELIMITER = "/";
+
+    public ServiceAPI(RestClient client, String graphSpace) {
+        super(client);
+        this.path(String.format(PATH, graphSpace));
+    }
+
+    private static String joinPath(String path, String id) {
+        return String.join(DELIMITER, path, id);
+    }
+
+    @Override
+    protected String type() {
+        return HugeType.SERVICES.string();
+    }
+
+    public List<String> list() {
+        RestResult result = this.client.get(this.path());
+
+        return result.readList(this.type(), String.class);
+    }
+
+    public Object add(OLTPService.OLTPServiceReq req) {
+        RestResult result
+                = this.client.post(this.path(), req);
+        return result.readObject(Map.class);
+    }
+
+    public void delete(String service, String message) {
+        this.client.delete(joinPath(this.path(), service),
+                           ImmutableMap.of(CONFIRM_MESSAGE, message));
+    }
+
+    public OLTPService get(String serviceName) {
+        RestResult result = this.client.get(this.path(), serviceName);
+
+        return result.readObject(OLTPService.class);
+    }
+
+    public void startService(String serviceName) {
+        this.client.put(joinPath(this.path(), "start"), serviceName,
+                        ImmutableMap.of());
+    }
+
+    public void stopService(String serviceName) {
+        this.client.put(joinPath(this.path(), "stop"), serviceName,
+                        ImmutableMap.of());
+    }
+}
+
diff --git 
a/hugegraph-client/src/main/java/org/apache/hugegraph/api/version/VersionAPI.java
 
b/hugegraph-client/src/main/java/org/apache/hugegraph/api/space/ServiceOptionAPI.java
similarity index 77%
copy from 
hugegraph-client/src/main/java/org/apache/hugegraph/api/version/VersionAPI.java
copy to 
hugegraph-client/src/main/java/org/apache/hugegraph/api/space/ServiceOptionAPI.java
index 2071a341..f47de855 100644
--- 
a/hugegraph-client/src/main/java/org/apache/hugegraph/api/version/VersionAPI.java
+++ 
b/hugegraph-client/src/main/java/org/apache/hugegraph/api/space/ServiceOptionAPI.java
@@ -15,28 +15,31 @@
  * under the License.
  */
 
-package org.apache.hugegraph.api.version;
+package org.apache.hugegraph.api.space;
 
 import org.apache.hugegraph.api.API;
 import org.apache.hugegraph.client.RestClient;
 import org.apache.hugegraph.rest.RestResult;
 import org.apache.hugegraph.structure.constant.HugeType;
-import org.apache.hugegraph.structure.version.Versions;
 
-public class VersionAPI extends API {
+import java.util.List;
 
-    public VersionAPI(RestClient client) {
+public class ServiceOptionAPI extends API {
+
+    private static final String PATH = "";
+
+    public ServiceOptionAPI(RestClient client) {
         super(client);
-        this.path(this.type());
     }
 
     @Override
     protected String type() {
-        return HugeType.VERSION.string();
+        return HugeType.SERVICEOPTIONS.string();
     }
 
-    public Versions get() {
+    public Object get() {
         RestResult result = this.client.get(this.path());
-        return result.readObject(Versions.class);
+
+        return result.readObject(List.class);
     }
 }
diff --git 
a/hugegraph-client/src/main/java/org/apache/hugegraph/api/task/TaskAPI.java 
b/hugegraph-client/src/main/java/org/apache/hugegraph/api/task/TaskAPI.java
index b348ef01..c0f048e6 100644
--- a/hugegraph-client/src/main/java/org/apache/hugegraph/api/task/TaskAPI.java
+++ b/hugegraph-client/src/main/java/org/apache/hugegraph/api/task/TaskAPI.java
@@ -21,7 +21,6 @@ import java.util.LinkedHashMap;
 import java.util.List;
 import java.util.Map;
 
-import org.apache.hugegraph.util.TaskCache;
 import org.apache.hugegraph.api.API;
 import org.apache.hugegraph.client.RestClient;
 import org.apache.hugegraph.rest.ClientException;
@@ -29,24 +28,37 @@ import org.apache.hugegraph.rest.RestResult;
 import org.apache.hugegraph.structure.Task;
 import org.apache.hugegraph.structure.constant.HugeType;
 import org.apache.hugegraph.util.E;
+import org.apache.hugegraph.util.TaskCache;
 
 import com.google.common.collect.ImmutableMap;
 
 public class TaskAPI extends API {
 
-    private static final String PATH = "graphs/%s/tasks";
-    private String graph;
     public static final String TASKS = "tasks";
     public static final String TASK_ID = "task_id";
     public static final long TASK_TIMEOUT = 60L;
+    private static final String PATH = "graphspaces/%s/graphs/%s/tasks";
     private static final long QUERY_INTERVAL = 500L;
+    private final String graphSpace;
+    private final String graph;
 
-    public TaskAPI(RestClient client, String graph) {
+    public TaskAPI(RestClient client, String graphSpace, String graph) {
         super(client);
-        this.path(String.format(PATH, graph));
+        this.path(String.format(PATH, graphSpace, graph));
+        this.graphSpace = graphSpace;
         this.graph = graph;
     }
 
+    public static long parseTaskId(Map<String, Object> task) {
+        E.checkState(task.size() == 1 && task.containsKey(TASK_ID),
+                     "Task must be formatted to {\"%s\" : id}, but got %s",
+                     TASK_ID, task);
+        Object taskId = task.get(TASK_ID);
+        E.checkState(taskId instanceof Number,
+                     "Task id must be number, but got '%s'", taskId);
+        return ((Number) taskId).longValue();
+    }
+
     @Override
     protected String type() {
         return HugeType.TASK.string();
@@ -142,14 +154,4 @@ public class TaskAPI extends API {
     private void removeFromCache(long taskId) {
         TaskCache.instance().remove(this, taskId);
     }
-
-    public static long parseTaskId(Map<String, Object> task) {
-        E.checkState(task.size() == 1 && task.containsKey(TASK_ID),
-                     "Task must be formatted to {\"%s\" : id}, but got %s",
-                     TASK_ID, task);
-        Object taskId = task.get(TASK_ID);
-        E.checkState(taskId instanceof Number,
-                     "Task id must be number, but got '%s'", taskId);
-        return ((Number) taskId).longValue();
-    }
 }
diff --git 
a/hugegraph-client/src/main/java/org/apache/hugegraph/api/variables/VariablesAPI.java
 
b/hugegraph-client/src/main/java/org/apache/hugegraph/api/variables/VariablesAPI.java
index 016be729..a7825596 100644
--- 
a/hugegraph-client/src/main/java/org/apache/hugegraph/api/variables/VariablesAPI.java
+++ 
b/hugegraph-client/src/main/java/org/apache/hugegraph/api/variables/VariablesAPI.java
@@ -28,11 +28,13 @@ import com.google.common.collect.ImmutableMap;
 
 public class VariablesAPI extends API {
 
-    private static final String PATH = "graphs/%s/%s";
+    private static final String PATH = "graphspaces/%s/graphs/%s/%s";
+    private static String batchPath = "";
 
-    public VariablesAPI(RestClient client, String graph) {
+    public VariablesAPI(RestClient client, String graphSpace, String graph) {
         super(client);
-        this.path(PATH, graph, this.type());
+        this.path(PATH, graphSpace, graph, this.type());
+        batchPath = String.join("/", this.path(), "batch");
     }
 
     @Override
diff --git 
a/hugegraph-client/src/main/java/org/apache/hugegraph/api/version/VersionAPI.java
 
b/hugegraph-client/src/main/java/org/apache/hugegraph/api/version/VersionAPI.java
index 2071a341..d192fae0 100644
--- 
a/hugegraph-client/src/main/java/org/apache/hugegraph/api/version/VersionAPI.java
+++ 
b/hugegraph-client/src/main/java/org/apache/hugegraph/api/version/VersionAPI.java
@@ -36,7 +36,7 @@ public class VersionAPI extends API {
     }
 
     public Versions get() {
-        RestResult result = this.client.get(this.path());
+        RestResult result = this.client.getVersions(this.path());
         return result.readObject(Versions.class);
     }
 }
diff --git 
a/hugegraph-client/src/main/java/org/apache/hugegraph/client/RestClient.java 
b/hugegraph-client/src/main/java/org/apache/hugegraph/client/RestClient.java
index 25462c70..5d29c845 100644
--- a/hugegraph-client/src/main/java/org/apache/hugegraph/client/RestClient.java
+++ b/hugegraph-client/src/main/java/org/apache/hugegraph/client/RestClient.java
@@ -17,10 +17,13 @@
 
 package org.apache.hugegraph.client;
 
+import java.util.Map;
+
 import org.apache.hugegraph.exception.ServerException;
 import org.apache.hugegraph.rest.AbstractRestClient;
 import org.apache.hugegraph.rest.ClientException;
 import org.apache.hugegraph.rest.RestClientConfig;
+import org.apache.hugegraph.rest.RestHeaders;
 import org.apache.hugegraph.rest.RestResult;
 import org.apache.hugegraph.serializer.PathDeserializer;
 import org.apache.hugegraph.structure.graph.Path;
@@ -30,18 +33,24 @@ import org.apache.hugegraph.util.VersionUtil.Version;
 
 import com.fasterxml.jackson.databind.module.SimpleModule;
 
+import lombok.Getter;
+import lombok.Setter;
+
 public class RestClient extends AbstractRestClient {
 
     private static final int SECOND = 1000;
 
-    private Version apiVersion = null;
-
     static {
         SimpleModule module = new SimpleModule();
         module.addDeserializer(Path.class, new PathDeserializer());
         RestResult.registerModule(module);
     }
 
+    private Version apiVersion = null;
+    @Setter
+    @Getter
+    private boolean supportGs = false;
+
     public RestClient(String url, String username, String password, int 
timeout) {
         super(url, username, password, timeout * SECOND);
     }
@@ -58,6 +67,12 @@ public class RestClient extends AbstractRestClient {
         super(url, config);
     }
 
+    private static String removeDefaultGsPrefix(String path) {
+        final String DEFAULT_GS_PATH_PREFIX = "graphspaces/DEFAULT/";
+        final String EMPTY = "";
+        return path.replaceFirst(DEFAULT_GS_PATH_PREFIX, EMPTY);
+    }
+
     public void apiVersion(Version version) {
         E.checkNotNull(version, "api version");
         this.apiVersion = version;
@@ -80,6 +95,81 @@ public class RestClient extends AbstractRestClient {
         return apiVersion != null && !VersionUtil.gte(apiVersion, minVersion);
     }
 
+    @Override
+    public RestResult post(String path, Object object) {
+        return super.post(supportGs ? path : removeDefaultGsPrefix(path), 
object);
+    }
+
+    @Override
+    public RestResult get(String path, String id) {
+        return super.get(supportGs ? path : removeDefaultGsPrefix(path), id);
+    }
+
+    public RestResult getVersions(String path) {
+        return super.get(path);
+    }
+
+    @Override
+    public RestResult delete(String path, Map<String, Object> params) {
+        return super.delete(supportGs ? path : removeDefaultGsPrefix(path), 
params);
+    }
+
+    @Override
+    public RestResult delete(String path, String id) {
+        return super.delete(supportGs ? path : removeDefaultGsPrefix(path), 
id);
+    }
+
+    @Override
+    public RestResult post(String path, Object object, RestHeaders headers) {
+        return super.post(supportGs ? path : removeDefaultGsPrefix(path), 
object, headers);
+    }
+
+    @Override
+    public RestResult post(String path, Object object, Map<String, Object> 
params) {
+        return super.post(supportGs ? path : removeDefaultGsPrefix(path), 
object, params);
+    }
+
+    @Override
+    public RestResult post(String path, Object object, RestHeaders headers,
+                           Map<String, Object> params) {
+        return super.post(supportGs ? path : removeDefaultGsPrefix(path), 
object, headers, params);
+    }
+
+    @Override
+    public RestResult put(String path, String id, Object object) {
+        return super.put(supportGs ? path : removeDefaultGsPrefix(path), id, 
object);
+    }
+
+    @Override
+    public RestResult put(String path, String id, Object object, RestHeaders 
headers) {
+        return super.put(supportGs ? path : removeDefaultGsPrefix(path), id, 
object,
+                         headers);
+    }
+
+    @Override
+    public RestResult put(String path, String id, Object object, Map<String, 
Object> params) {
+        return super.put(supportGs ? path : removeDefaultGsPrefix(path), id, 
object,
+                         params);
+    }
+
+    @Override
+    public RestResult put(String path, String id, Object object,
+                          RestHeaders headers,
+                          Map<String, Object> params) {
+        return super.put(supportGs ? path : removeDefaultGsPrefix(path), id, 
object, headers,
+                         params);
+    }
+
+    @Override
+    public RestResult get(String path) {
+        return super.get(supportGs ? path : removeDefaultGsPrefix(path));
+    }
+
+    @Override
+    public RestResult get(String path, Map<String, Object> params) {
+        return super.get(supportGs ? path : removeDefaultGsPrefix(path), 
params);
+    }
+
     @Override
     protected void checkStatus(okhttp3.Response response, int... statuses) {
         boolean match = false;
diff --git 
a/hugegraph-client/src/main/java/org/apache/hugegraph/driver/CypherManager.java 
b/hugegraph-client/src/main/java/org/apache/hugegraph/driver/CypherManager.java
index c53c48a9..498e568a 100644
--- 
a/hugegraph-client/src/main/java/org/apache/hugegraph/driver/CypherManager.java
+++ 
b/hugegraph-client/src/main/java/org/apache/hugegraph/driver/CypherManager.java
@@ -18,25 +18,42 @@
 package org.apache.hugegraph.driver;
 
 import org.apache.hugegraph.api.gremlin.CypherAPI;
+import org.apache.hugegraph.api.job.CypherJobAPI;
+import org.apache.hugegraph.client.RestClient;
 import org.apache.hugegraph.structure.gremlin.Response;
 import org.apache.hugegraph.structure.gremlin.ResultSet;
-import org.apache.hugegraph.client.RestClient;
 
 public class CypherManager {
 
     private final GraphManager graphManager;
+    private final CypherJobAPI cypherJobAPI;
+    private final String graphSpace;
+    private final String graph;
+
     private final CypherAPI cypherAPI;
 
-    public CypherManager(RestClient client, String graph,
+    public CypherManager(RestClient client, String graphSpace, String graph,
                          GraphManager graphManager) {
         this.graphManager = graphManager;
-        this.cypherAPI = new CypherAPI(client, graph);
+        this.cypherAPI = new CypherAPI(client);
+        this.cypherJobAPI = new CypherJobAPI(client, graphSpace, graph);
+        this.graphSpace = graphSpace;
+        this.graph = graph;
+    }
+
+    public ResultSet cypher(String cypher) {
+        return execute(cypher);
     }
 
     public ResultSet execute(String cypher) {
-        Response response = this.cypherAPI.post(cypher);
+        Response response = this.cypherAPI.post(this.graphSpace, this.graph, 
cypher);
         response.graphManager(this.graphManager);
         // TODO: Can add some checks later
         return response.result();
     }
+
+    public long executeAsTask(String cypher) {
+        return this.cypherJobAPI.execute(cypher);
+    }
+
 }
diff --git 
a/hugegraph-client/src/main/java/org/apache/hugegraph/driver/GraphManager.java 
b/hugegraph-client/src/main/java/org/apache/hugegraph/driver/GraphManager.java
index 702d3c2f..98b82cd4 100644
--- 
a/hugegraph-client/src/main/java/org/apache/hugegraph/driver/GraphManager.java
+++ 
b/hugegraph-client/src/main/java/org/apache/hugegraph/driver/GraphManager.java
@@ -39,14 +39,20 @@ import org.apache.hugegraph.util.E;
 
 public class GraphManager {
 
+    private final String graphSpace;
     private final String graph;
     private final VertexAPI vertexAPI;
     private final EdgeAPI edgeAPI;
 
-    public GraphManager(RestClient client, String graph) {
+    public GraphManager(RestClient client, String graphSpace, String graph) {
+        this.graphSpace = graphSpace;
         this.graph = graph;
-        this.vertexAPI = new VertexAPI(client, graph);
-        this.edgeAPI = new EdgeAPI(client, graph);
+        this.vertexAPI = new VertexAPI(client, graphSpace, graph);
+        this.edgeAPI = new EdgeAPI(client, graphSpace, graph);
+    }
+
+    public String graphSpace() {
+        return this.graphSpace;
     }
 
     public String graph() {
diff --git 
a/hugegraph-client/src/main/java/org/apache/hugegraph/driver/GraphSpaceManager.java
 
b/hugegraph-client/src/main/java/org/apache/hugegraph/driver/GraphSpaceManager.java
new file mode 100644
index 00000000..fd0ee9eb
--- /dev/null
+++ 
b/hugegraph-client/src/main/java/org/apache/hugegraph/driver/GraphSpaceManager.java
@@ -0,0 +1,100 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with this
+ * work for additional information regarding copyright ownership. The ASF
+ * licenses this file to You under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.hugegraph.driver;
+
+import java.util.List;
+import java.util.Map;
+
+import org.apache.hugegraph.api.space.GraphSpaceAPI;
+import org.apache.hugegraph.client.RestClient;
+import org.apache.hugegraph.structure.space.GraphSpace;
+
+public class GraphSpaceManager {
+
+    private final GraphSpaceAPI graphSpaceAPI;
+
+    public GraphSpaceManager(RestClient client) {
+        this.graphSpaceAPI = new GraphSpaceAPI(client);
+    }
+
+    public List<String> listGraphSpace() {
+        return this.graphSpaceAPI.list();
+    }
+
+    public List<Map<String, Object>> listProfile() {
+        return this.graphSpaceAPI.listProfile(null);
+    }
+
+    public List<Map<String, Object>> listProfile(String prefix) {
+        return this.graphSpaceAPI.listProfile(prefix);
+    }
+
+    public Map<String, String> setDefault(String name) {
+        return this.graphSpaceAPI.setDefault(name);
+    }
+
+    public Map<String, String> getDefault() {
+        return this.graphSpaceAPI.getDefault();
+    }
+
+    public GraphSpace getGraphSpace(String name) {
+        return this.graphSpaceAPI.get(name);
+    }
+
+    public GraphSpace createGraphSpace(GraphSpace graphSpace) {
+        return this.graphSpaceAPI.create(graphSpace);
+    }
+
+    public void deleteGraphSpace(String name) {
+        this.graphSpaceAPI.delete(name);
+    }
+
+    public GraphSpace updateGraphSpace(GraphSpace graphSpace) {
+        return this.graphSpaceAPI.update(graphSpace);
+    }
+
+    public Map<String, String> setDefaultRole(String name, String user,
+                                              String role) {
+        return this.graphSpaceAPI.setDefaultRole(name, user, role, "");
+    }
+
+    public Map<String, String> setDefaultRole(String name, String user,
+                                              String role, String graph) {
+        return this.graphSpaceAPI.setDefaultRole(name, user, role, graph);
+    }
+
+    public boolean checkDefaultRole(String name, String user,
+                                    String role) {
+        return this.graphSpaceAPI.checkDefaultRole(name, user, role, "");
+    }
+
+    public boolean checkDefaultRole(String name, String user,
+                                    String role, String graph) {
+        return this.graphSpaceAPI.checkDefaultRole(name, user, role, graph);
+    }
+
+    public Map<String, String> deleteDefaultRole(String name, String user,
+                                                 String role) {
+        return this.graphSpaceAPI.deleteDefaultRole(name, user, role, "");
+    }
+
+    public Map<String, String> deleteDefaultRole(String name, String user,
+                                                 String role, String graph) {
+        return this.graphSpaceAPI.deleteDefaultRole(name, user, role, graph);
+    }
+}
diff --git 
a/hugegraph-client/src/main/java/org/apache/hugegraph/driver/GraphsManager.java 
b/hugegraph-client/src/main/java/org/apache/hugegraph/driver/GraphsManager.java
index a9674d87..e4ebf40c 100644
--- 
a/hugegraph-client/src/main/java/org/apache/hugegraph/driver/GraphsManager.java
+++ 
b/hugegraph-client/src/main/java/org/apache/hugegraph/driver/GraphsManager.java
@@ -29,8 +29,8 @@ public class GraphsManager {
 
     private GraphsAPI graphsAPI;
 
-    public GraphsManager(RestClient client) {
-        this.graphsAPI = new GraphsAPI(client);
+    public GraphsManager(RestClient client, String graphSpace) {
+        this.graphsAPI = new GraphsAPI(client, graphSpace);
     }
 
     public Map<String, String> createGraph(String name, String configText) {
diff --git 
a/hugegraph-client/src/main/java/org/apache/hugegraph/driver/GremlinManager.java
 
b/hugegraph-client/src/main/java/org/apache/hugegraph/driver/GremlinManager.java
index a558e3e1..b77a9d3a 100644
--- 
a/hugegraph-client/src/main/java/org/apache/hugegraph/driver/GremlinManager.java
+++ 
b/hugegraph-client/src/main/java/org/apache/hugegraph/driver/GremlinManager.java
@@ -20,31 +20,40 @@ package org.apache.hugegraph.driver;
 import org.apache.hugegraph.api.gremlin.GremlinAPI;
 import org.apache.hugegraph.api.gremlin.GremlinRequest;
 import org.apache.hugegraph.api.job.GremlinJobAPI;
+import org.apache.hugegraph.client.RestClient;
 import org.apache.hugegraph.structure.gremlin.Response;
 import org.apache.hugegraph.structure.gremlin.ResultSet;
-import org.apache.hugegraph.client.RestClient;
 
 public class GremlinManager {
 
     private final GraphManager graphManager;
 
-    private GremlinAPI gremlinAPI;
-    private GremlinJobAPI gremlinJobAPI;
-    private String graph;
+    private final GremlinAPI gremlinAPI;
+    private final GremlinJobAPI gremlinJobAPI;
+    private final String graphSpace;
+    private final String graph;
 
-    public GremlinManager(RestClient client, String graph,
+    public GremlinManager(RestClient client, String graphSpace, String graph,
                           GraphManager graphManager) {
         this.graphManager = graphManager;
         this.gremlinAPI = new GremlinAPI(client);
-        this.gremlinJobAPI = new GremlinJobAPI(client, graph);
+        this.gremlinJobAPI = new GremlinJobAPI(client, graphSpace, graph);
+        this.graphSpace = graphSpace;
         this.graph = graph;
     }
 
     public ResultSet execute(GremlinRequest request) {
-        // Bind "graph" to all graphs
-        request.aliases.put("graph", this.graph);
-        // Bind "g" to all graphs by custom rule which define in gremlin 
server.
-        request.aliases.put("g", "__g_" + this.graph);
+        if (this.gremlinAPI.isSupportGs()) {
+            // Bind "graph" and graph space to all graphs
+            request.aliases.put("graph", this.graphSpace + "-" + this.graph);
+            // Bind "g" and graph space to all graphs by custom rule which 
define in gremlin server.
+            request.aliases.put("g", "__g_" + this.graphSpace + "-" + 
this.graph);
+        } else {
+            // Bind "graph" to all graphs
+            request.aliases.put("graph", this.graph);
+            // Bind "g" to all graphs by custom rule which define in gremlin 
server.
+            request.aliases.put("g", "__g_" + this.graph);
+        }
 
         Response response = this.gremlinAPI.post(request);
         response.graphManager(this.graphManager);
diff --git 
a/hugegraph-client/src/main/java/org/apache/hugegraph/driver/HugeClient.java 
b/hugegraph-client/src/main/java/org/apache/hugegraph/driver/HugeClient.java
index 798405d7..8a9ef20c 100644
--- a/hugegraph-client/src/main/java/org/apache/hugegraph/driver/HugeClient.java
+++ b/hugegraph-client/src/main/java/org/apache/hugegraph/driver/HugeClient.java
@@ -27,6 +27,8 @@ import org.apache.hugegraph.version.ClientVersion;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
+import com.google.common.base.Strings;
+
 /**
  * The HugeClient class is the main entry point for interacting with a 
HugeGraph server.
  * It provides methods for managing graphs, schemas, jobs, tasks, and other 
resources.
@@ -42,7 +44,9 @@ public class HugeClient implements Closeable {
 
     private final RestClient client;
     private final boolean borrowedClient;
-
+    protected String graphSpaceName;
+    protected String graphName;
+    protected GraphSpaceManager graphSpace;
     private VersionManager version;
     private GraphsManager graphs;
     private SchemaManager schema;
@@ -63,9 +67,12 @@ public class HugeClient implements Closeable {
      */
     public HugeClient(HugeClientBuilder builder) {
         this.borrowedClient = false;
+        this.graphSpaceName = builder.graphSpace();
+        this.graphName = builder.graph();
         RestClientConfig config;
         try {
             config = RestClientConfig.builder()
+                                     .token(builder.token())
                                      .user(builder.username())
                                      .password(builder.password())
                                      .timeout(builder.timeout())
@@ -84,7 +91,7 @@ public class HugeClient implements Closeable {
         }
 
         try {
-            this.initManagers(this.client, builder.graph());
+            this.initManagers(this.client, builder.graphSpace(), 
builder.graph());
         } catch (Throwable e) {
             // TODO: catch some exception(like IO/Network related) rather than 
throw Throwable
             this.client.close();
@@ -92,14 +99,26 @@ public class HugeClient implements Closeable {
         }
     }
 
-    public HugeClient(HugeClient client, String graph) {
+    // QUESTION: add gs to method param?
+    public HugeClient(HugeClient client, String graphSpace, String graph) {
         this.borrowedClient = true;
         this.client = client.client;
-        this.initManagers(this.client, graph);
+        this.initManagers(this.client, graphSpace, graph);
+    }
+
+    public static HugeClientBuilder builder(String url, String graphSpace, 
String graph) {
+        return new HugeClientBuilder(url, graphSpace, graph);
     }
 
     public static HugeClientBuilder builder(String url, String graph) {
-        return new HugeClientBuilder(url, graph);
+        return new HugeClientBuilder(url, 
HugeClientBuilder.DEFAULT_GRAPHSPACE, graph);
+    }
+
+    public HugeClient assignGraph(String graphSpace, String graph) {
+        this.graphSpaceName = graphSpace;
+        this.graphName = graph;
+        this.initManagers(this.client, this.graphSpaceName, this.graphName);
+        return this;
     }
 
     @Override
@@ -109,23 +128,29 @@ public class HugeClient implements Closeable {
         }
     }
 
-    private void initManagers(RestClient client, String graph) {
+    public void initManagers(RestClient client, String graphSpace,
+                             String graph) {
         assert client != null;
         // Check hugegraph-server api version
         this.version = new VersionManager(client);
         this.checkServerApiVersion();
 
-        this.graphs = new GraphsManager(client);
-        this.schema = new SchemaManager(client, graph);
-        this.graph = new GraphManager(client, graph);
-        this.gremlin = new GremlinManager(client, graph, this.graph);
-        this.cypher = new CypherManager(client, graph, this.graph);
-        this.traverser = new TraverserManager(client, this.graph);
-        this.variable = new VariablesManager(client, graph);
-        this.job = new JobManager(client, graph);
-        this.task = new TaskManager(client, graph);
+        this.graphs = new GraphsManager(client, graphSpace);
         this.auth = new AuthManager(client, graph);
         this.metrics = new MetricsManager(client);
+        this.graphSpace = new GraphSpaceManager(client);
+        if (!Strings.isNullOrEmpty(graph)) {
+            this.schema = new SchemaManager(client, graphSpace, graph);
+            this.graph = new GraphManager(client, graphSpace, graph);
+            this.gremlin = new GremlinManager(client, graphSpace,
+                                              graph, this.graph);
+            this.cypher = new CypherManager(client, graphSpace,
+                                            graph, this.graph);
+            this.traverser = new TraverserManager(client, this.graph);
+            this.variable = new VariablesManager(client, graphSpace, graph);
+            this.job = new JobManager(client, graphSpace, graph);
+            this.task = new TaskManager(client, graphSpace, graph);
+        }
     }
 
     private void checkServerApiVersion() {
@@ -134,6 +159,16 @@ public class HugeClient implements Closeable {
         //       0.81 equals to the {latest_api_version} +10
         VersionUtil.check(apiVersion, "0.38", "0.81", "hugegraph-api in 
server");
         this.client.apiVersion(apiVersion);
+        boolean supportGs = VersionUtil.gte(this.version.getCoreVersion(), 
"2.0");
+        this.client.setSupportGs(supportGs);
+    }
+
+    public String getGraphSpaceName() {
+        return graphSpaceName;
+    }
+
+    public String getGraphName() {
+        return graphName;
     }
 
     public GraphsManager graphs() {
@@ -180,14 +215,22 @@ public class HugeClient implements Closeable {
         return this.metrics;
     }
 
-    public void setAuthContext(String auth) {
-        this.client.setAuthContext(auth);
+    public GraphSpaceManager graphSpace() {
+        return this.graphSpace;
+    }
+
+    public VersionManager versionManager() {
+        return version;
     }
 
     public String getAuthContext() {
         return this.client.getAuthContext();
     }
 
+    public void setAuthContext(String auth) {
+        this.client.setAuthContext(auth);
+    }
+
     public void resetAuthContext() {
         this.client.resetAuthContext();
     }
diff --git 
a/hugegraph-client/src/main/java/org/apache/hugegraph/driver/HugeClientBuilder.java
 
b/hugegraph-client/src/main/java/org/apache/hugegraph/driver/HugeClientBuilder.java
index b3f68412..9b9c03b9 100644
--- 
a/hugegraph-client/src/main/java/org/apache/hugegraph/driver/HugeClientBuilder.java
+++ 
b/hugegraph-client/src/main/java/org/apache/hugegraph/driver/HugeClientBuilder.java
@@ -25,17 +25,21 @@ import okhttp3.OkHttpClient;
 
 public class HugeClientBuilder {
 
+    static final String DEFAULT_GRAPHSPACE = "DEFAULT";
+
     private static final int CPUS = Runtime.getRuntime().availableProcessors();
-    private static final int DEFAULT_TIMEOUT = 20;
     private static final int DEFAULT_MAX_CONNS = 4 * CPUS;
     private static final int DEFAULT_MAX_CONNS_PER_ROUTE = 2 * CPUS;
     private static final int DEFAULT_IDLE_TIME = 30;
     private static final int SECOND = 1000;
+    private static final int DEFAULT_TIMEOUT = 20 * SECOND;
 
     private String url;
+    private String graphSpace;
     private String graph;
     private String username;
     private String password;
+    private String token;
     private int timeout;
     private int maxConns;
     private int maxConnsPerRoute;
@@ -47,17 +51,19 @@ public class HugeClientBuilder {
     private Integer connectTimeout;
     private Integer readTimeout;
 
-    public HugeClientBuilder(String url, String graph) {
+    public HugeClientBuilder(String url, String graphSpace, String graph) {
         E.checkArgument(url != null && !url.isEmpty(),
                         "Expect a string value as the url parameter argument, 
but got: %s", url);
         E.checkArgument(graph != null && !graph.isEmpty(),
                         "Expect a string value as the graph name parameter 
argument, but got: %s",
                         graph);
         this.url = url;
+        this.graphSpace = graphSpace;
         this.graph = graph;
         this.username = "";
         this.password = "";
-        this.timeout = DEFAULT_TIMEOUT * SECOND;
+        this.token = "";
+        this.timeout = DEFAULT_TIMEOUT;
 
         this.maxConns = DEFAULT_MAX_CONNS;
         this.maxConnsPerRoute = DEFAULT_MAX_CONNS_PER_ROUTE;
@@ -75,6 +81,11 @@ public class HugeClientBuilder {
         return new HugeClient(this);
     }
 
+    public HugeClientBuilder configGraphSpace(String graphSpace) {
+        this.graphSpace = graphSpace;
+        return this;
+    }
+
     public HugeClientBuilder configGraph(String graph) {
         this.graph = graph;
         return this;
@@ -149,10 +160,22 @@ public class HugeClientBuilder {
         return this;
     }
 
+    public HugeClientBuilder configToken(String token) {
+        if (token != null) {
+            this.token = token;
+        }
+
+        return this;
+    }
+
     public String url() {
         return this.url;
     }
 
+    public String graphSpace() {
+        return this.graphSpace;
+    }
+
     public String graph() {
         return this.graph;
     }
@@ -165,6 +188,10 @@ public class HugeClientBuilder {
         return this.password;
     }
 
+    public String token() {
+        return this.token;
+    }
+
     public int timeout() {
         return this.timeout;
     }
diff --git 
a/hugegraph-client/src/main/java/org/apache/hugegraph/driver/JobManager.java 
b/hugegraph-client/src/main/java/org/apache/hugegraph/driver/JobManager.java
index 501a2e57..ed4c92bd 100644
--- a/hugegraph-client/src/main/java/org/apache/hugegraph/driver/JobManager.java
+++ b/hugegraph-client/src/main/java/org/apache/hugegraph/driver/JobManager.java
@@ -29,9 +29,9 @@ public class JobManager {
     private RebuildAPI rebuildAPI;
     private TaskAPI taskAPI;
 
-    public JobManager(RestClient client, String graph) {
-        this.rebuildAPI = new RebuildAPI(client, graph);
-        this.taskAPI = new TaskAPI(client, graph);
+    public JobManager(RestClient client, String graphSpace, String graph) {
+        this.rebuildAPI = new RebuildAPI(client, graphSpace, graph);
+        this.taskAPI = new TaskAPI(client, graphSpace, graph);
     }
 
     public void rebuild(VertexLabel vertexLabel) {
diff --git 
a/hugegraph-client/src/main/java/org/apache/hugegraph/driver/SchemaManager.java 
b/hugegraph-client/src/main/java/org/apache/hugegraph/driver/SchemaManager.java
index 8b088db3..9a13205f 100644
--- 
a/hugegraph-client/src/main/java/org/apache/hugegraph/driver/SchemaManager.java
+++ 
b/hugegraph-client/src/main/java/org/apache/hugegraph/driver/SchemaManager.java
@@ -43,13 +43,13 @@ public class SchemaManager {
     private SchemaAPI schemaAPI;
     private TaskAPI taskAPI;
 
-    public SchemaManager(RestClient client, String graph) {
-        this.propertyKeyAPI = new PropertyKeyAPI(client, graph);
-        this.vertexLabelAPI = new VertexLabelAPI(client, graph);
-        this.edgeLabelAPI = new EdgeLabelAPI(client, graph);
-        this.indexLabelAPI = new IndexLabelAPI(client, graph);
-        this.schemaAPI = new SchemaAPI(client, graph);
-        this.taskAPI = new TaskAPI(client, graph);
+    public SchemaManager(RestClient client, String graphSpace, String graph) {
+        this.propertyKeyAPI = new PropertyKeyAPI(client, graphSpace, graph);
+        this.vertexLabelAPI = new VertexLabelAPI(client, graphSpace, graph);
+        this.edgeLabelAPI = new EdgeLabelAPI(client, graphSpace, graph);
+        this.indexLabelAPI = new IndexLabelAPI(client, graphSpace, graph);
+        this.schemaAPI = new SchemaAPI(client, graphSpace, graph);
+        this.taskAPI = new TaskAPI(client, graphSpace, graph);
     }
 
     public PropertyKey.Builder propertyKey(String name) {
diff --git 
a/hugegraph-client/src/main/java/org/apache/hugegraph/driver/TaskManager.java 
b/hugegraph-client/src/main/java/org/apache/hugegraph/driver/TaskManager.java
index 6d92e416..e04a6311 100644
--- 
a/hugegraph-client/src/main/java/org/apache/hugegraph/driver/TaskManager.java
+++ 
b/hugegraph-client/src/main/java/org/apache/hugegraph/driver/TaskManager.java
@@ -21,15 +21,15 @@ import java.util.List;
 
 import org.apache.hugegraph.api.task.TaskAPI;
 import org.apache.hugegraph.api.task.TasksWithPage;
-import org.apache.hugegraph.structure.Task;
 import org.apache.hugegraph.client.RestClient;
+import org.apache.hugegraph.structure.Task;
 
 public class TaskManager {
 
     private TaskAPI taskAPI;
 
-    public TaskManager(RestClient client, String graph) {
-        this.taskAPI = new TaskAPI(client, graph);
+    public TaskManager(RestClient client, String graphSpace, String graph) {
+        this.taskAPI = new TaskAPI(client, graphSpace, graph);
     }
 
     public List<Task> list() {
diff --git 
a/hugegraph-client/src/main/java/org/apache/hugegraph/driver/VariablesManager.java
 
b/hugegraph-client/src/main/java/org/apache/hugegraph/driver/VariablesManager.java
index a62bb708..535ad299 100644
--- 
a/hugegraph-client/src/main/java/org/apache/hugegraph/driver/VariablesManager.java
+++ 
b/hugegraph-client/src/main/java/org/apache/hugegraph/driver/VariablesManager.java
@@ -17,17 +17,17 @@
 
 package org.apache.hugegraph.driver;
 
+import java.util.Map;
+
 import org.apache.hugegraph.api.variables.VariablesAPI;
 import org.apache.hugegraph.client.RestClient;
 
-import java.util.Map;
-
 public class VariablesManager {
 
-    private VariablesAPI variablesAPI;
+    private final VariablesAPI variablesAPI;
 
-    public VariablesManager(RestClient client, String graph) {
-        this.variablesAPI = new VariablesAPI(client, graph);
+    public VariablesManager(RestClient client, String graphSpace, String 
graph) {
+        this.variablesAPI = new VariablesAPI(client, graphSpace, graph);
     }
 
     public Map<String, Object> get(String key) {
diff --git 
a/hugegraph-client/src/main/java/org/apache/hugegraph/driver/factory/DefaultHugeClientFactory.java
 
b/hugegraph-client/src/main/java/org/apache/hugegraph/driver/factory/DefaultHugeClientFactory.java
new file mode 100644
index 00000000..33a86c9e
--- /dev/null
+++ 
b/hugegraph-client/src/main/java/org/apache/hugegraph/driver/factory/DefaultHugeClientFactory.java
@@ -0,0 +1,63 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with this
+ * work for additional information regarding copyright ownership. The ASF
+ * licenses this file to You under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.hugegraph.driver.factory;
+
+import org.apache.hugegraph.driver.HugeClient;
+import org.apache.hugegraph.util.E;
+
+public class DefaultHugeClientFactory {
+
+    private final String defaultHugeGraph = "hugegraph";
+    private final String[] urls;
+
+    public DefaultHugeClientFactory(String[] urls) {
+        this.urls = urls;
+    }
+
+    public HugeClient createClient(String graphSpace, String graph) {
+        return this.createClient(graphSpace, graph, 60);
+    }
+
+    public HugeClient createClient(String graphSpace, String graph,
+                                   int timeout) {
+        return this.createClient(graphSpace, graph, null, null, null, timeout);
+    }
+
+    public HugeClient createClient(String graphSpace, String graph,
+                                   String token, String username,
+                                   String password) {
+        return createClient(graphSpace, graph, token, username, password, 60);
+    }
+
+    public HugeClient createClient(String graphSpace, String graph,
+                                   String token, String username,
+                                   String password, int timeout) {
+        E.checkArgument(timeout > 0, "Client timeout must > 0");
+
+        int r = (int) Math.floor(Math.random() * urls.length);
+        String url = this.urls[r];
+
+        HugeClient client = HugeClient.builder(url, graphSpace, graph)
+                                      .configToken(token)
+                                      .configUser(username, password)
+                                      .configTimeout(timeout)
+                                      .build();
+
+        return client;
+    }
+}
diff --git 
a/hugegraph-client/src/main/java/org/apache/hugegraph/example/BatchExample.java 
b/hugegraph-client/src/main/java/org/apache/hugegraph/example/BatchExample.java
index 7b86a099..c7bec016 100644
--- 
a/hugegraph-client/src/main/java/org/apache/hugegraph/example/BatchExample.java
+++ 
b/hugegraph-client/src/main/java/org/apache/hugegraph/example/BatchExample.java
@@ -20,17 +20,18 @@ package org.apache.hugegraph.example;
 import java.util.ArrayList;
 import java.util.List;
 
-import org.apache.hugegraph.structure.graph.Edge;
-import org.apache.hugegraph.structure.graph.Vertex;
 import org.apache.hugegraph.driver.GraphManager;
 import org.apache.hugegraph.driver.HugeClient;
 import org.apache.hugegraph.driver.SchemaManager;
+import org.apache.hugegraph.structure.graph.Edge;
+import org.apache.hugegraph.structure.graph.Vertex;
 
 public class BatchExample {
 
     public static void main(String[] args) {
         // If connect failed will throw an exception.
         HugeClient hugeClient = HugeClient.builder("http://localhost:8080";,
+                                                   "DEFAULT",
                                                    "hugegraph").build();
 
         SchemaManager schema = hugeClient.schema();
diff --git 
a/hugegraph-client/src/main/java/org/apache/hugegraph/example/MovieExample.java 
b/hugegraph-client/src/main/java/org/apache/hugegraph/example/MovieExample.java
index 15fb4e84..aec7e49a 100644
--- 
a/hugegraph-client/src/main/java/org/apache/hugegraph/example/MovieExample.java
+++ 
b/hugegraph-client/src/main/java/org/apache/hugegraph/example/MovieExample.java
@@ -17,17 +17,18 @@
 
 package org.apache.hugegraph.example;
 
-import org.apache.hugegraph.structure.constant.T;
-import org.apache.hugegraph.structure.graph.Vertex;
 import org.apache.hugegraph.driver.GraphManager;
 import org.apache.hugegraph.driver.HugeClient;
 import org.apache.hugegraph.driver.SchemaManager;
+import org.apache.hugegraph.structure.constant.T;
+import org.apache.hugegraph.structure.graph.Vertex;
 
 public class MovieExample {
 
     public static void main(String[] args) {
         // If connect failed will throw a exception.
         HugeClient hugeClient = HugeClient.builder("http://localhost:8080";,
+                                                   "DEFAULT",
                                                    "hugegraph").build();
 
         SchemaManager schema = hugeClient.schema();
diff --git 
a/hugegraph-client/src/main/java/org/apache/hugegraph/example/SingleExample.java
 
b/hugegraph-client/src/main/java/org/apache/hugegraph/example/SingleExample.java
index 6c710ed0..66eb98df 100644
--- 
a/hugegraph-client/src/main/java/org/apache/hugegraph/example/SingleExample.java
+++ 
b/hugegraph-client/src/main/java/org/apache/hugegraph/example/SingleExample.java
@@ -21,23 +21,26 @@ import java.io.IOException;
 import java.util.Iterator;
 import java.util.List;
 
+import org.apache.hugegraph.driver.GraphManager;
+import org.apache.hugegraph.driver.GremlinManager;
+import org.apache.hugegraph.driver.HugeClient;
+import org.apache.hugegraph.driver.SchemaManager;
 import org.apache.hugegraph.structure.constant.T;
 import org.apache.hugegraph.structure.graph.Edge;
 import org.apache.hugegraph.structure.graph.Path;
 import org.apache.hugegraph.structure.graph.Vertex;
 import org.apache.hugegraph.structure.gremlin.Result;
 import org.apache.hugegraph.structure.gremlin.ResultSet;
-import org.apache.hugegraph.driver.GraphManager;
-import org.apache.hugegraph.driver.GremlinManager;
-import org.apache.hugegraph.driver.HugeClient;
-import org.apache.hugegraph.driver.SchemaManager;
 
 public class SingleExample {
 
     public static void main(String[] args) throws IOException {
         // If connect failed will throw a exception.
-        HugeClient hugeClient = HugeClient.builder("http://localhost:8080";,
-                                                   "hugegraph").build();
+        HugeClient hugeClient = HugeClient.builder("http://127.0.0.1:8080";,
+                                                   "DEFAULT",
+                                                   "hugegraph")
+                                          .configUser("admin", "admin")
+                                          .build();
 
         SchemaManager schema = hugeClient.schema();
 
diff --git 
a/hugegraph-client/src/main/java/org/apache/hugegraph/serializer/direct/reuse/BytesDemo.java
 
b/hugegraph-client/src/main/java/org/apache/hugegraph/serializer/direct/reuse/BytesDemo.java
index ea7bbbd9..4ab709f1 100644
--- 
a/hugegraph-client/src/main/java/org/apache/hugegraph/serializer/direct/reuse/BytesDemo.java
+++ 
b/hugegraph-client/src/main/java/org/apache/hugegraph/serializer/direct/reuse/BytesDemo.java
@@ -50,7 +50,7 @@ public class BytesDemo {
         int edgeLogicPartitions = 16;
         int vertexLogicPartitions = 8;
         // If connect failed will throw an exception.
-        client = HugeClient.builder("http://localhost:8081";, 
"hugegraph").build();
+        client = HugeClient.builder("http://localhost:8081";, "DEFAULT", 
"hugegraph").build();
 
         SchemaManager schema = client.schema();
 
diff --git 
a/hugegraph-client/src/main/java/org/apache/hugegraph/structure/constant/HugeType.java
 
b/hugegraph-client/src/main/java/org/apache/hugegraph/structure/constant/HugeType.java
index b28716fc..7dc1efc2 100644
--- 
a/hugegraph-client/src/main/java/org/apache/hugegraph/structure/constant/HugeType.java
+++ 
b/hugegraph-client/src/main/java/org/apache/hugegraph/structure/constant/HugeType.java
@@ -17,6 +17,9 @@
 
 package org.apache.hugegraph.structure.constant;
 
+import java.util.HashMap;
+import java.util.Map;
+
 public enum HugeType {
 
     // Schema
@@ -35,6 +38,11 @@ public enum HugeType {
     LOGIN(56, "login"),
     LOGOUT(57, "logout"),
     TOKEN_VERIFY(58, "verify"),
+    MANAGER(59, "managers"),
+    KG_LOGIN(60, "kglogin"),
+    ROLE(61, "roles"),
+    WHITE_IP_LIST(62, "whiteiplist"),
+    VERMEER(63, "vermeer"),
 
     // Data
     VERTEX(101, "vertices"),
@@ -49,6 +57,15 @@ public enum HugeType {
     // Job
     JOB(150, "jobs"),
 
+    // Services
+    SERVICES(190, "services"),
+
+    // Service configs
+    SERVICECONFIGS(192, "service_configs"),
+
+    // Service options
+    SERVICEOPTIONS(194, "service_options"),
+
     // Gremlin
     GREMLIN(201, "gremlin"),
 
@@ -61,17 +78,50 @@ public enum HugeType {
     VERSION(230, "versions"),
 
     // Metrics
-    METRICS(240, "metrics");
+    METRICS(240, "metrics"),
+
+    // Configs
+    CONFIGS(249, "configs"),
+
+    // GraphSpaces
+    GRAPHSPACES(250, "graphSpaces"),
+
+    // SchemeTemplate
+    SCHEMATEMPLATES(252, "schema_templates"),
+
+    // PD
+    PD(253, "pd"),
+
+    // HStore
+    HSTORE(254, "hstore"),
+
+    // System Graph
+    SYSTEM_GRAPH(255, "system_graph"),
+
+    // graph auth
+    GRAPH_AUTH(256, "graph_auth");
+
+    static Map<String, HugeType> fromNames = new HashMap<>();
+
+    static {
+        for (HugeType type : HugeType.values()) {
+            fromNames.put(type.name, type);
+        }
+    }
 
     private final int code;
     private final String name;
 
     HugeType(int code, String name) {
-        assert code < 256;
+        assert code < 300;
         this.code = code;
         this.name = name;
     }
 
+    public static HugeType fromName(String name) {
+        return fromNames.get(name);
+    }
+
     public int code() {
         return this.code;
     }
diff --git 
a/hugegraph-client/src/main/java/org/apache/hugegraph/structure/space/GraphSpace.java
 
b/hugegraph-client/src/main/java/org/apache/hugegraph/structure/space/GraphSpace.java
new file mode 100644
index 00000000..5120e7e4
--- /dev/null
+++ 
b/hugegraph-client/src/main/java/org/apache/hugegraph/structure/space/GraphSpace.java
@@ -0,0 +1,360 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with this
+ * work for additional information regarding copyright ownership. The ASF
+ * licenses this file to You under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.hugegraph.structure.space;
+
+import com.fasterxml.jackson.annotation.JsonIgnore;
+import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
+import com.fasterxml.jackson.annotation.JsonProperty;
+
+import java.util.HashMap;
+import java.util.Map;
+
+@JsonIgnoreProperties(ignoreUnknown = true)
+public class GraphSpace {
+
+    @JsonProperty("store_group")
+    public int storeGroup;
+    @JsonProperty("storage_limit")
+    public int storageLimit; // GB
+    @JsonProperty("oltp_namespace")
+    public String oltpNamespace;
+    @JsonProperty("name")
+    private String name;
+    @JsonProperty("nickname")
+    private String nickname;
+    @JsonProperty("description")
+    private String description;
+    @JsonProperty("cpu_limit")
+    private int cpuLimit;
+    @JsonProperty("memory_limit")
+    private int memoryLimit; // GB
+    @JsonProperty("compute_cpu_limit")
+    private int computeCpuLimit;
+    @JsonProperty("compute_memory_limit")
+    private int computeMemoryLimit; // GB
+    @JsonProperty("max_graph_number")
+    private int maxGraphNumber;
+    @JsonProperty("max_role_number")
+    private int maxRoleNumber;
+    @JsonProperty("operator_image_path")
+    private String operatorImagePath; //
+    @JsonProperty("internal_algorithm_image_url")
+    private String internalAlgorithmImageUrl;
+    @JsonProperty("olap_namespace")
+    private String olapNamespace;
+    @Deprecated
+    @JsonProperty("storage_namespace")
+    private String storageNamespace;
+
+    @JsonProperty("cpu_used")
+    private int cpuUsed;
+    @JsonProperty("memory_used")
+    private int memoryUsed; // GB
+    @JsonProperty("storage_used")
+    private int storageUsed; // GB
+    @JsonProperty("storage_percent")
+    private double storagePercent;
+    @JsonProperty("graph_number_used")
+    private int graphNumberUsed;
+    @JsonProperty("role_number_used")
+    private int roleNumberUsed;
+    @JsonProperty("auth")
+    private boolean auth = false;
+    @JsonProperty("dp_username")
+    private String dpUserName;
+    @JsonProperty("dp_password")
+    private String dpPassWord;
+
+    @JsonIgnore
+    private String createTime;
+    @JsonIgnore
+    private String updateTime;
+
+    @JsonProperty("configs")
+    private Map<String, Object> configs = new HashMap<>();
+
+    public GraphSpace() {
+    }
+
+    public GraphSpace(String name) {
+        this.name = name;
+    }
+
+    public String getName() {
+        return name;
+    }
+
+    public GraphSpace setName(String name) {
+        this.name = name;
+        return this;
+    }
+
+    public String getNickname() {
+        return nickname;
+    }
+
+    public GraphSpace setNickname(String nickname) {
+        this.nickname = nickname;
+        return this;
+    }
+
+    public String getDpUserName() {
+        return dpUserName;
+    }
+
+    public void setDpUserName(String dpUserName) {
+        this.dpUserName = dpUserName;
+    }
+
+    public String getDpPassWord() {
+        return dpPassWord;
+    }
+
+    public void setDpPassWord(String dpPassWord) {
+        this.dpPassWord = dpPassWord;
+    }
+
+    public String getDescription() {
+        return description;
+    }
+
+    public GraphSpace setDescription(String description) {
+        this.description = description;
+        return this;
+    }
+
+    public int getCpuLimit() {
+        return cpuLimit;
+    }
+
+    public GraphSpace setCpuLimit(int cpuLimit) {
+        this.cpuLimit = cpuLimit;
+        return this;
+    }
+
+    public int getMemoryLimit() {
+        return memoryLimit;
+    }
+
+    public GraphSpace setMemoryLimit(int memoryLimit) {
+        this.memoryLimit = memoryLimit;
+        return this;
+    }
+
+    public int getStorageLimit() {
+        return storageLimit;
+    }
+
+    public GraphSpace setStorageLimit(int storageLimit) {
+        this.storageLimit = storageLimit;
+        return this;
+    }
+
+    public int getMaxGraphNumber() {
+        return maxGraphNumber;
+    }
+
+    public GraphSpace setMaxGraphNumber(int maxGraphNumber) {
+        this.maxGraphNumber = maxGraphNumber;
+        return this;
+    }
+
+    public int getMaxRoleNumber() {
+        return maxRoleNumber;
+    }
+
+    public GraphSpace setMaxRoleNumber(int maxRoleNumber) {
+        this.maxRoleNumber = maxRoleNumber;
+        return this;
+    }
+
+    public String getOltpNamespace() {
+        return oltpNamespace;
+    }
+
+    public GraphSpace setOltpNamespace(String oltpNamespace) {
+        this.oltpNamespace = oltpNamespace;
+        return this;
+    }
+
+    public String getOlapNamespace() {
+        return olapNamespace;
+    }
+
+    public GraphSpace setOlapNamespace(String olapNamespace) {
+        this.olapNamespace = olapNamespace;
+        return this;
+    }
+
+    public String getOperatorImagePath() {
+        return operatorImagePath;
+    }
+
+    public void setOperatorImagePath(String operatorImagePath) {
+        this.operatorImagePath = operatorImagePath;
+    }
+
+    public String getInternalAlgorithmImageUrl() {
+        return internalAlgorithmImageUrl;
+    }
+
+    public void setInternalAlgorithmImageUrl(String internalAlgorithmImageUrl) 
{
+        this.internalAlgorithmImageUrl = internalAlgorithmImageUrl;
+    }
+
+    public String getStorageNamespace() {
+        return storageNamespace;
+    }
+
+    public GraphSpace setStorageNamespace(String storageNamespace) {
+        this.storageNamespace = storageNamespace;
+        return this;
+    }
+
+    public int getCpuUsed() {
+        return cpuUsed;
+    }
+
+    public GraphSpace setCpuUsed(int cpuUsed) {
+        this.cpuUsed = cpuUsed;
+        return this;
+    }
+
+    public int getMemoryUsed() {
+        return memoryUsed;
+    }
+
+    public GraphSpace setMemoryUsed(int memoryUsed) {
+        this.memoryUsed = memoryUsed;
+        return this;
+    }
+
+    public int getComputeCpuLimit() {
+        return computeCpuLimit;
+    }
+
+    public void setComputeCpuLimit(int computeCpuLimit) {
+        this.computeCpuLimit = computeCpuLimit;
+    }
+
+    public int getComputeMemoryLimit() {
+        return computeMemoryLimit;
+    }
+
+    public void setComputeMemoryLimit(int computeMemoryLimit) {
+        this.computeMemoryLimit = computeMemoryLimit;
+    }
+
+    public int getStorageUsed() {
+        return storageUsed;
+    }
+
+    public GraphSpace setStorageUsed(int storageUsed) {
+        this.storageUsed = storageUsed;
+        return this;
+    }
+
+    public double getStoragePercent() {
+        return storagePercent;
+    }
+
+    public GraphSpace setStoragePercent(double storagePercent) {
+        this.storagePercent = storagePercent;
+        return this;
+    }
+
+    public int getGraphNumberUsed() {
+        return graphNumberUsed;
+    }
+
+    public GraphSpace setGraphNumberUsed(int graphNumberUsed) {
+        this.graphNumberUsed = graphNumberUsed;
+        return this;
+    }
+
+    public int getRoleNumberUsed() {
+        return roleNumberUsed;
+    }
+
+    public GraphSpace setRoleNumberUsed(int roleNumberUsed) {
+        this.roleNumberUsed = roleNumberUsed;
+        return this;
+    }
+
+    public boolean isAuth() {
+        return auth;
+    }
+
+    public void setAuth(boolean auth) {
+        this.auth = auth;
+    }
+
+    public String getCreateTime() {
+        return createTime;
+    }
+
+    public void setCreateTime(String createTime) {
+        this.createTime = createTime;
+    }
+
+    public String getUpdateTime() {
+        return updateTime;
+    }
+
+    public void setUpdateTime(String updateTime) {
+        this.updateTime = updateTime;
+    }
+
+    public Map<String, Object> getConfigs() {
+        return configs;
+    }
+
+    public GraphSpace setConfigs(
+            Map<String, Object> configs) {
+        this.configs = configs;
+        return this;
+    }
+
+    public Object convertReq() {
+        return new GraphSpaceReq(this);
+    }
+
+    @JsonIgnoreProperties({"cpu_used", "memory_used", "storage_used",
+                           "storage_percent", "graph_number_used", 
"role_number_used",
+                           "create_time", "update_time"})
+    public static class GraphSpaceReq extends GraphSpace {
+
+        public GraphSpaceReq(GraphSpace graphSpace) {
+            this.setName(graphSpace.getName());
+            this.setNickname(graphSpace.getNickname());
+            this.setAuth(graphSpace.isAuth());
+            this.setDescription(graphSpace.getDescription());
+            this.setCpuLimit(graphSpace.getCpuLimit());
+            this.setMemoryLimit(graphSpace.getMemoryLimit());
+            this.setComputeCpuLimit(graphSpace.getComputeCpuLimit());
+            this.setComputeMemoryLimit(graphSpace.getComputeMemoryLimit());
+            this.setOperatorImagePath(graphSpace.getOperatorImagePath());
+            
this.setInternalAlgorithmImageUrl(graphSpace.getInternalAlgorithmImageUrl());
+            this.setStorageLimit(graphSpace.getStorageLimit());
+            this.setMaxGraphNumber(graphSpace.getMaxGraphNumber());
+            this.setMaxRoleNumber(graphSpace.getMaxRoleNumber());
+            this.setOltpNamespace(graphSpace.getOltpNamespace());
+            this.setOlapNamespace(graphSpace.getOlapNamespace());
+        }
+    }
+}
diff --git 
a/hugegraph-client/src/main/java/org/apache/hugegraph/structure/space/HStoreNodeInfo.java
 
b/hugegraph-client/src/main/java/org/apache/hugegraph/structure/space/HStoreNodeInfo.java
new file mode 100644
index 00000000..94568d74
--- /dev/null
+++ 
b/hugegraph-client/src/main/java/org/apache/hugegraph/structure/space/HStoreNodeInfo.java
@@ -0,0 +1,117 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with this
+ * work for additional information regarding copyright ownership. The ASF
+ * licenses this file to You under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.hugegraph.structure.space;
+
+import com.fasterxml.jackson.annotation.JsonProperty;
+
+import java.util.List;
+
+public class HStoreNodeInfo {
+
+    // partitions
+    @JsonProperty("partitions")
+    List<HStorePartitionInfo> hStorePartitionInfoList;
+    // Node id
+    @JsonProperty("id")
+    private String id;
+    // 总空间大小
+    @JsonProperty("capacity")
+    private long capacity;
+    // 已使用空间
+    @JsonProperty("used")
+    private long used;
+    // 节点状态
+    @JsonProperty("state")
+    private String state;
+    // grpc ip:port
+    @JsonProperty("address")
+    private String address;
+
+    public String id() {
+        return id;
+    }
+
+    public void id(String id) {
+        this.id = id;
+    }
+
+    public long capacity() {
+        return capacity;
+    }
+
+    public void capacity(long capacity) {
+        this.capacity = capacity;
+    }
+
+    public long used() {
+        return used;
+    }
+
+    public void used(long used) {
+        this.used = used;
+    }
+
+    public String address() {
+        return address;
+    }
+
+    public void address(String address) {
+        this.address = address;
+    }
+
+    public List<HStorePartitionInfo> hStorePartitionInfoList() {
+        return hStorePartitionInfoList;
+    }
+
+    public void hStorePartitionInfoList(
+            List<HStorePartitionInfo> hStorePartitionInfoList) {
+        this.hStorePartitionInfoList = hStorePartitionInfoList;
+    }
+
+    public static class HStorePartitionInfo {
+
+        @JsonProperty("id")
+        private int id;
+        @JsonProperty("graph_name")
+        private String graphName;
+
+        public HStorePartitionInfo() {
+        }
+
+        public HStorePartitionInfo(int id, String graphName) {
+            this.id = id;
+            this.graphName = graphName;
+        }
+
+        public int id() {
+            return id;
+        }
+
+        public void id(int id) {
+            this.id = id;
+        }
+
+        public String graphName() {
+            return graphName;
+        }
+
+        public void graphName(String graphName) {
+            this.graphName = graphName;
+        }
+    }
+}
diff --git 
a/hugegraph-client/src/main/java/org/apache/hugegraph/structure/space/OLTPService.java
 
b/hugegraph-client/src/main/java/org/apache/hugegraph/structure/space/OLTPService.java
new file mode 100644
index 00000000..d3daf38e
--- /dev/null
+++ 
b/hugegraph-client/src/main/java/org/apache/hugegraph/structure/space/OLTPService.java
@@ -0,0 +1,241 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with this
+ * work for additional information regarding copyright ownership. The ASF
+ * licenses this file to You under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.hugegraph.structure.space;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
+import com.fasterxml.jackson.annotation.JsonProperty;
+
+@JsonIgnoreProperties(ignoreUnknown = true)
+public class OLTPService {
+
+    @JsonProperty("name")
+    private String name;
+    @JsonProperty("description")
+    private String description;
+    @JsonProperty("deployment_type")
+    private DepleymentType depleymentType;
+
+    @JsonProperty("type")
+    private String type = "OLTP";
+
+    @JsonProperty("count")
+    private int count = 1; // maximum number of runnable nodes
+    @JsonProperty("running")
+    private int running;
+
+    @JsonProperty("cpu_limit")
+    private int cpuLimit = 1;
+    @JsonProperty("memory_limit")
+    private int memoryLimit = 4; // GB
+    @JsonProperty("storage_limit")
+    private int storageLimit = 100;
+
+    @JsonProperty("route_type")
+    private String routeType = null;
+    @JsonProperty("port")
+    private int port = 0;
+
+    @JsonProperty("create_time")
+    private String createTime;
+
+    @JsonProperty("update_time")
+    private String updateTime;
+
+    @JsonProperty("urls")
+    private List<String> urls = new ArrayList<>();
+
+    @JsonProperty("configs")
+    private Map<String, Object> configs = new HashMap();
+
+    @JsonProperty
+    private ServiceStatus status = ServiceStatus.UNKNOWN;
+
+    public String getName() {
+        return name;
+    }
+
+    public void setName(String name) {
+        this.name = name;
+    }
+
+    public String getDescription() {
+        return description;
+    }
+
+    public void setDescription(String description) {
+        this.description = description;
+    }
+
+    public DepleymentType getDepleymentType() {
+        return depleymentType;
+    }
+
+    public void setDepleymentType(
+            DepleymentType depleymentType) {
+        this.depleymentType = depleymentType;
+    }
+
+    public int getCount() {
+        return count;
+    }
+
+    public void setCount(int count) {
+        this.count = count;
+    }
+
+    public int getRunning() {
+        return running;
+    }
+
+    public void setRunning(int running) {
+        this.running = running;
+    }
+
+    public int getCpuLimit() {
+        return cpuLimit;
+    }
+
+    public void setCpuLimit(int cpuLimit) {
+        this.cpuLimit = cpuLimit;
+    }
+
+    public int getMemoryLimit() {
+        return memoryLimit;
+    }
+
+    public void setMemoryLimit(int memoryLimit) {
+        this.memoryLimit = memoryLimit;
+    }
+
+    public int getStorageLimit() {
+        return storageLimit;
+    }
+
+    public void setStorageLimit(int storageLimit) {
+        this.storageLimit = storageLimit;
+    }
+
+    public String getRouteType() {
+        return routeType;
+    }
+
+    public void setRouteType(String routeType) {
+        this.routeType = routeType;
+    }
+
+    public String getType() {
+        return type;
+    }
+
+    public void setType(String type) {
+        this.type = type;
+    }
+
+    public int getPort() {
+        return port;
+    }
+
+    public void setPort(int port) {
+        this.port = port;
+    }
+
+    public List<String> getUrls() {
+        return urls;
+    }
+
+    public void setUrls(List<String> urls) {
+        this.urls = urls;
+    }
+
+    public Map<String, Object> getConfigs() {
+        return configs;
+    }
+
+    public void setConfigs(Map<String, Object> configs) {
+        this.configs = configs;
+    }
+
+    public ServiceStatus getStatus() {
+        return status;
+    }
+
+    public void setStatus(
+            ServiceStatus status) {
+        this.status = status;
+    }
+
+    public String getCreateTime() {
+        return createTime;
+    }
+
+    public void setCreateTime(String createTime) {
+        this.createTime = createTime;
+    }
+
+    public String getUpdateTime() {
+        return updateTime;
+    }
+
+    public void setUpdateTime(String updateTime) {
+        this.updateTime = updateTime;
+    }
+
+    public boolean checkIsK8s() {
+        return DepleymentType.K8S.equals(this.depleymentType);
+    }
+
+    public enum DepleymentType {
+        K8S,
+        MANUAL
+    }
+
+    public enum ServiceStatus {
+        UNKNOWN,
+        STARTING,
+        RUNNING,
+        STOPPED
+    }
+
+    @JsonIgnoreProperties(value = {"configs", "create_time", "update_time",
+                                   "running", "status"}, ignoreUnknown = true)
+    public static class OLTPServiceReq extends OLTPService {
+
+        public static OLTPServiceReq fromBase(OLTPService service) {
+            OLTPServiceReq req = new OLTPServiceReq();
+
+            req.setName(service.name);
+            req.setDescription(service.description);
+            req.setDepleymentType(service.depleymentType);
+            req.setType(service.type);
+            req.setCount(service.count);
+            req.setCpuLimit(service.cpuLimit);
+            req.setMemoryLimit(service.memoryLimit);
+            req.setStorageLimit(service.storageLimit);
+            req.setRouteType(service.routeType);
+            req.setPort(service.port);
+            req.setUrls(service.urls);
+
+            return req;
+        }
+    }
+}
diff --git 
a/hugegraph-client/src/main/java/org/apache/hugegraph/api/job/JobAPI.java 
b/hugegraph-client/src/main/java/org/apache/hugegraph/structure/space/OLTPServiceConfig.java
similarity index 57%
copy from 
hugegraph-client/src/main/java/org/apache/hugegraph/api/job/JobAPI.java
copy to 
hugegraph-client/src/main/java/org/apache/hugegraph/structure/space/OLTPServiceConfig.java
index da2300ac..701d7e37 100644
--- a/hugegraph-client/src/main/java/org/apache/hugegraph/api/job/JobAPI.java
+++ 
b/hugegraph-client/src/main/java/org/apache/hugegraph/structure/space/OLTPServiceConfig.java
@@ -15,26 +15,34 @@
  * under the License.
  */
 
-package org.apache.hugegraph.api.job;
+package org.apache.hugegraph.structure.space;
 
-import org.apache.hugegraph.api.API;
-import org.apache.hugegraph.client.RestClient;
-import org.apache.hugegraph.structure.constant.HugeType;
+import com.fasterxml.jackson.annotation.JsonProperty;
 
-public abstract class JobAPI extends API {
+import java.util.HashMap;
+import java.util.Map;
 
-    // For example: graphs/hugegraph/jobs/gremlin
-    private static final String PATH = "graphs/%s/%s/%s";
+public class OLTPServiceConfig {
 
-    public JobAPI(RestClient client, String graph) {
-        super(client);
-        this.path(String.format(PATH, graph, this.type(), this.jobType()));
+    @JsonProperty("name")
+    private String name;
+
+    @JsonProperty("configs")
+    private Map<String, Object> configs = new HashMap();
+
+    public String getName() {
+        return name;
     }
 
-    @Override
-    protected String type() {
-        return HugeType.JOB.string();
+    public void setName(String name) {
+        this.name = name;
     }
 
-    protected abstract String jobType();
+    public Map<String, Object> getConfigs() {
+        return configs;
+    }
+
+    public void setConfigs(Map<String, Object> configs) {
+        this.configs = configs;
+    }
 }
diff --git 
a/hugegraph-client/src/main/java/org/apache/hugegraph/api/gremlin/GremlinAPI.java
 
b/hugegraph-client/src/main/java/org/apache/hugegraph/structure/space/PDNodeInfo.java
similarity index 54%
copy from 
hugegraph-client/src/main/java/org/apache/hugegraph/api/gremlin/GremlinAPI.java
copy to 
hugegraph-client/src/main/java/org/apache/hugegraph/structure/space/PDNodeInfo.java
index 31795d19..ce181545 100644
--- 
a/hugegraph-client/src/main/java/org/apache/hugegraph/api/gremlin/GremlinAPI.java
+++ 
b/hugegraph-client/src/main/java/org/apache/hugegraph/structure/space/PDNodeInfo.java
@@ -15,28 +15,45 @@
  * under the License.
  */
 
-package org.apache.hugegraph.api.gremlin;
+package org.apache.hugegraph.structure.space;
 
-import org.apache.hugegraph.api.API;
-import org.apache.hugegraph.client.RestClient;
-import org.apache.hugegraph.rest.RestResult;
-import org.apache.hugegraph.structure.constant.HugeType;
-import org.apache.hugegraph.structure.gremlin.Response;
+import com.fasterxml.jackson.annotation.JsonProperty;
 
-public class GremlinAPI extends API {
+public class PDNodeInfo {
 
-    public GremlinAPI(RestClient client) {
-        super(client);
-        this.path(type());
+    @JsonProperty("ip")
+    private String ip;
+
+    @JsonProperty("state")
+    private String state;
+
+    @JsonProperty("is_leader")
+    private boolean isLeader;
+
+    public PDNodeInfo() {
+    }
+
+    public String getIp() {
+        return ip;
+    }
+
+    public void setIp(String ip) {
+        this.ip = ip;
+    }
+
+    public String getState() {
+        return state;
+    }
+
+    public void setState(String state) {
+        this.state = state;
     }
 
-    @Override
-    protected String type() {
-        return HugeType.GREMLIN.string();
+    public boolean isLeader() {
+        return isLeader;
     }
 
-    public Response post(GremlinRequest request) {
-        RestResult result = this.client.post(this.path(), request);
-        return result.readObject(Response.class);
+    public void setLeader(boolean leader) {
+        isLeader = leader;
     }
 }
diff --git 
a/hugegraph-client/src/main/java/org/apache/hugegraph/structure/space/SchemaTemplate.java
 
b/hugegraph-client/src/main/java/org/apache/hugegraph/structure/space/SchemaTemplate.java
new file mode 100644
index 00000000..8b6538d1
--- /dev/null
+++ 
b/hugegraph-client/src/main/java/org/apache/hugegraph/structure/space/SchemaTemplate.java
@@ -0,0 +1,110 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with this
+ * work for additional information regarding copyright ownership. The ASF
+ * licenses this file to You under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.hugegraph.structure.space;
+
+import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
+import com.fasterxml.jackson.annotation.JsonProperty;
+import com.google.common.collect.ImmutableMap;
+
+import java.util.Map;
+
+@JsonIgnoreProperties(ignoreUnknown = true)
+public class SchemaTemplate {
+
+    @JsonProperty("name")
+    private String name;
+    @JsonProperty("schema")
+    private String schema;
+
+    @JsonProperty("create_time")
+    private String createTime;
+
+    @JsonProperty("update_time")
+    private String updateTime;
+
+    @JsonProperty("creator")
+    private String creator;
+
+    public SchemaTemplate() {
+    }
+
+    public SchemaTemplate(String name, String schema) {
+        this.name = name;
+        this.schema = schema;
+    }
+
+    public static SchemaTemplate fromMap(Map<String, String> map) {
+        return new SchemaTemplate(map.get("name"), map.get("schema"));
+    }
+
+    public void name(String name) {
+        this.name = name;
+    }
+
+    public String name() {
+        return this.name;
+    }
+
+    public String schema() {
+        return this.schema;
+    }
+
+    public void schema(String schema) {
+        this.schema = schema;
+    }
+
+    public String createTime() {
+        return createTime;
+    }
+
+    public void createTime(String createTime) {
+        this.createTime = createTime;
+    }
+
+    public String updateTime() {
+        return updateTime;
+    }
+
+    public void updateTime(String updateTime) {
+        this.updateTime = updateTime;
+    }
+
+    public String creator() {
+        return creator;
+    }
+
+    public void creator(String creator) {
+        this.creator = creator;
+    }
+
+    public Map<String, String> asMap() {
+        return ImmutableMap.of("name", this.name, "schema", this.schema);
+    }
+
+    @JsonIgnoreProperties({"create_time", "update_time", "creator"})
+    public static class SchemaTemplateReq extends SchemaTemplate {
+
+        public static SchemaTemplateReq fromBase(SchemaTemplate 
schemaTemplate) {
+            SchemaTemplateReq req = new SchemaTemplateReq();
+            req.name(schemaTemplate.name);
+            req.schema(schemaTemplate.schema);
+
+            return req;
+        }
+    }
+}
diff --git 
a/hugegraph-client/src/main/java/org/apache/hugegraph/api/schema/SchemaElementAPI.java
 
b/hugegraph-client/src/main/java/org/apache/hugegraph/structure/space/StorageService.java
similarity index 61%
copy from 
hugegraph-client/src/main/java/org/apache/hugegraph/api/schema/SchemaElementAPI.java
copy to 
hugegraph-client/src/main/java/org/apache/hugegraph/structure/space/StorageService.java
index 41729447..6a1ebe56 100644
--- 
a/hugegraph-client/src/main/java/org/apache/hugegraph/api/schema/SchemaElementAPI.java
+++ 
b/hugegraph-client/src/main/java/org/apache/hugegraph/structure/space/StorageService.java
@@ -15,20 +15,11 @@
  * under the License.
  */
 
-package org.apache.hugegraph.api.schema;
+package org.apache.hugegraph.structure.space;
 
-import org.apache.hugegraph.api.API;
-import org.apache.hugegraph.client.RestClient;
-import org.apache.hugegraph.structure.SchemaElement;
+import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
 
-public abstract class SchemaElementAPI extends API {
+@JsonIgnoreProperties
+public class StorageService {
 
-    private static final String PATH = "graphs/%s/schema/%s";
-
-    public SchemaElementAPI(RestClient client, String graph) {
-        super(client);
-        this.path(PATH, graph, this.type());
-    }
-
-    protected abstract Object checkCreateOrUpdate(SchemaElement schemaElement);
 }
diff --git 
a/hugegraph-client/src/test/java/org/apache/hugegraph/BaseClientTest.java 
b/hugegraph-client/src/test/java/org/apache/hugegraph/BaseClientTest.java
index 471f135d..2fda81d6 100644
--- a/hugegraph-client/src/test/java/org/apache/hugegraph/BaseClientTest.java
+++ b/hugegraph-client/src/test/java/org/apache/hugegraph/BaseClientTest.java
@@ -50,6 +50,8 @@ import com.google.common.collect.ImmutableMap;
 public class BaseClientTest {
 
     protected static final String BASE_URL = "http://127.0.0.1:8080";;
+    protected static final String DEFAULT_GRAPHSPACE = "DEFAULT";
+    protected static final String GRAPHSPACE = DEFAULT_GRAPHSPACE;
     protected static final String GRAPH = "hugegraph";
     protected static final String USERNAME = "admin";
     protected static final String PASSWORD = "pa";
@@ -57,8 +59,11 @@ public class BaseClientTest {
 
     private static HugeClient client;
 
-    protected static void open() {
-        client = HugeClient.builder(BASE_URL, GRAPH).configUser(USERNAME, 
PASSWORD).build();
+    protected static HugeClient open() {
+        client = HugeClient.builder(BASE_URL, DEFAULT_GRAPHSPACE, GRAPH)
+                           .configUser(USERNAME, PASSWORD)
+                           .build();
+        return client;
     }
 
     @BeforeClass
diff --git 
a/hugegraph-client/src/test/java/org/apache/hugegraph/api/BaseApiTest.java 
b/hugegraph-client/src/test/java/org/apache/hugegraph/api/BaseApiTest.java
index c6570149..e9759faa 100644
--- a/hugegraph-client/src/test/java/org/apache/hugegraph/api/BaseApiTest.java
+++ b/hugegraph-client/src/test/java/org/apache/hugegraph/api/BaseApiTest.java
@@ -74,20 +74,19 @@ public class BaseApiTest extends BaseClientTest {
         versionAPI = new VersionAPI(client);
         client.apiVersion(VersionUtil.Version.of(versionAPI.get().get("api")));
 
-        graphsAPI = new GraphsAPI(client);
-
-        propertyKeyAPI = new PropertyKeyAPI(client, GRAPH);
-        vertexLabelAPI = new VertexLabelAPI(client, GRAPH);
-        edgeLabelAPI = new EdgeLabelAPI(client, GRAPH);
-        indexLabelAPI = new IndexLabelAPI(client, GRAPH);
-        schemaAPI = new SchemaAPI(client, GRAPH);
-
-        vertexAPI = new VertexAPI(client, GRAPH);
-        edgeAPI = new EdgeAPI(client, GRAPH);
-
-        variablesAPI = new VariablesAPI(client, GRAPH);
-        taskAPI = new TaskAPI(client, GRAPH);
-        rebuildAPI = new RebuildAPI(client, GRAPH);
+        graphsAPI = new GraphsAPI(client, GRAPHSPACE);
+        propertyKeyAPI = new PropertyKeyAPI(client, GRAPHSPACE, GRAPH);
+        vertexLabelAPI = new VertexLabelAPI(client, GRAPHSPACE, GRAPH);
+        edgeLabelAPI = new EdgeLabelAPI(client, GRAPHSPACE, GRAPH);
+        indexLabelAPI = new IndexLabelAPI(client, GRAPHSPACE, GRAPH);
+        schemaAPI = new SchemaAPI(client, GRAPHSPACE, GRAPH);
+
+        vertexAPI = new VertexAPI(client, GRAPHSPACE, GRAPH);
+        edgeAPI = new EdgeAPI(client, GRAPHSPACE, GRAPH);
+
+        variablesAPI = new VariablesAPI(client, GRAPHSPACE, GRAPH);
+        taskAPI = new TaskAPI(client, GRAPHSPACE, GRAPH);
+        rebuildAPI = new RebuildAPI(client, GRAPHSPACE, GRAPH);
     }
 
     @AfterClass
@@ -101,10 +100,6 @@ public class BaseApiTest extends BaseClientTest {
         BaseClientTest.clear();
     }
 
-    protected RestClient client() {
-        return client;
-    }
-
     protected static void clearData() {
         // Clear edge
         edgeAPI.list(-1).results().forEach(edge -> {
@@ -159,4 +154,8 @@ public class BaseApiTest extends BaseClientTest {
         }
         taskAPI.waitUntilTaskSuccess(taskId, timeout);
     }
+
+    protected RestClient client() {
+        return client;
+    }
 }
diff --git 
a/hugegraph-client/src/test/java/org/apache/hugegraph/api/GraphsApiTest.java 
b/hugegraph-client/src/test/java/org/apache/hugegraph/api/GraphsApiTest.java
index 5cd7b37d..8904ead6 100644
--- a/hugegraph-client/src/test/java/org/apache/hugegraph/api/GraphsApiTest.java
+++ b/hugegraph-client/src/test/java/org/apache/hugegraph/api/GraphsApiTest.java
@@ -46,6 +46,64 @@ public class GraphsApiTest extends BaseApiTest {
     private static final String GRAPH3 = "hugegraph3";
     private static final String CONFIG3_PATH = 
"src/test/resources/hugegraph-clone.properties";
 
+    protected static void initPropertyKey(HugeClient client) {
+        SchemaManager schema = client.schema();
+        schema.propertyKey("name").asText().ifNotExist().create();
+        schema.propertyKey("age").asInt().ifNotExist().create();
+        schema.propertyKey("city").asText().ifNotExist().create();
+        schema.propertyKey("lang").asText().ifNotExist().create();
+        schema.propertyKey("date").asDate().ifNotExist().create();
+        schema.propertyKey("price").asInt().ifNotExist().create();
+        schema.propertyKey("weight").asDouble().ifNotExist().create();
+    }
+
+    protected static void initVertexLabel(HugeClient client) {
+        SchemaManager schema = client.schema();
+
+        schema.vertexLabel("person")
+              .properties("name", "age", "city")
+              .primaryKeys("name")
+              .nullableKeys("city")
+              .ifNotExist()
+              .create();
+
+        schema.vertexLabel("software")
+              .properties("name", "lang", "price")
+              .primaryKeys("name")
+              .nullableKeys("price")
+              .ifNotExist()
+              .create();
+
+        schema.vertexLabel("book")
+              .useCustomizeStringId()
+              .properties("name", "price")
+              .nullableKeys("price")
+              .ifNotExist()
+              .create();
+    }
+
+    protected static void initEdgeLabel(HugeClient client) {
+        SchemaManager schema = client.schema();
+
+        schema.edgeLabel("knows")
+              .sourceLabel("person")
+              .targetLabel("person")
+              .multiTimes()
+              .properties("date", "city")
+              .sortKeys("date")
+              .nullableKeys("city")
+              .ifNotExist()
+              .create();
+
+        schema.edgeLabel("created")
+              .sourceLabel("person")
+              .targetLabel("software")
+              .properties("date", "city")
+              .nullableKeys("city")
+              .ifNotExist()
+              .create();
+    }
+
     @Override
     @After
     public void teardown() {
@@ -79,7 +137,7 @@ public class GraphsApiTest extends BaseApiTest {
 
         Assert.assertEquals(initialGraphNumber + 1, graphsAPI.list().size());
 
-        HugeClient client = new HugeClient(baseClient(), GRAPH2);
+        HugeClient client = new HugeClient(baseClient(), GRAPHSPACE, GRAPH2);
         // Insert graph schema and data
         initPropertyKey(client);
         initVertexLabel(client);
@@ -151,7 +209,7 @@ public class GraphsApiTest extends BaseApiTest {
 
         Assert.assertEquals(initialGraphNumber + 1, graphsAPI.list().size());
 
-        HugeClient client = new HugeClient(baseClient(), GRAPH3);
+        HugeClient client = new HugeClient(baseClient(), GRAPHSPACE, GRAPH3);
         // Insert graph schema and data
         initPropertyKey(client);
         initVertexLabel(client);
@@ -216,7 +274,7 @@ public class GraphsApiTest extends BaseApiTest {
 
         Assert.assertEquals(initialGraphNumber + 1, graphsAPI.list().size());
 
-        HugeClient client = new HugeClient(baseClient(), GRAPH3);
+        HugeClient client = new HugeClient(baseClient(), GRAPHSPACE, GRAPH3);
         // Insert graph schema and data
         initPropertyKey(client);
         initVertexLabel(client);
@@ -266,62 +324,4 @@ public class GraphsApiTest extends BaseApiTest {
 
         Assert.assertEquals(initialGraphNumber, graphsAPI.list().size());
     }
-
-    protected static void initPropertyKey(HugeClient client) {
-        SchemaManager schema = client.schema();
-        schema.propertyKey("name").asText().ifNotExist().create();
-        schema.propertyKey("age").asInt().ifNotExist().create();
-        schema.propertyKey("city").asText().ifNotExist().create();
-        schema.propertyKey("lang").asText().ifNotExist().create();
-        schema.propertyKey("date").asDate().ifNotExist().create();
-        schema.propertyKey("price").asInt().ifNotExist().create();
-        schema.propertyKey("weight").asDouble().ifNotExist().create();
-    }
-
-    protected static void initVertexLabel(HugeClient client) {
-        SchemaManager schema = client.schema();
-
-        schema.vertexLabel("person")
-              .properties("name", "age", "city")
-              .primaryKeys("name")
-              .nullableKeys("city")
-              .ifNotExist()
-              .create();
-
-        schema.vertexLabel("software")
-              .properties("name", "lang", "price")
-              .primaryKeys("name")
-              .nullableKeys("price")
-              .ifNotExist()
-              .create();
-
-        schema.vertexLabel("book")
-              .useCustomizeStringId()
-              .properties("name", "price")
-              .nullableKeys("price")
-              .ifNotExist()
-              .create();
-    }
-
-    protected static void initEdgeLabel(HugeClient client) {
-        SchemaManager schema = client.schema();
-
-        schema.edgeLabel("knows")
-              .sourceLabel("person")
-              .targetLabel("person")
-              .multiTimes()
-              .properties("date", "city")
-              .sortKeys("date")
-              .nullableKeys("city")
-              .ifNotExist()
-              .create();
-
-        schema.edgeLabel("created")
-              .sourceLabel("person")
-              .targetLabel("software")
-              .properties("date", "city")
-              .nullableKeys("city")
-              .ifNotExist()
-              .create();
-    }
 }
diff --git 
a/hugegraph-client/src/test/java/org/apache/hugegraph/api/VertexApiTest.java 
b/hugegraph-client/src/test/java/org/apache/hugegraph/api/VertexApiTest.java
index e2230051..49530a5e 100644
--- a/hugegraph-client/src/test/java/org/apache/hugegraph/api/VertexApiTest.java
+++ b/hugegraph-client/src/test/java/org/apache/hugegraph/api/VertexApiTest.java
@@ -50,6 +50,11 @@ public class VertexApiTest extends BaseApiTest {
         BaseApiTest.initEdgeLabel();
     }
 
+    @SuppressWarnings("unused")
+    private static void assertContains(List<Vertex> vertices, Vertex vertex) {
+        Assert.assertTrue(Utils.contains(vertices, vertex));
+    }
+
     @Override
     @After
     public void teardown() {
@@ -665,9 +670,4 @@ public class VertexApiTest extends BaseApiTest {
             vertexAPI.delete("not-exist-v");
         });
     }
-
-    @SuppressWarnings("unused")
-    private static void assertContains(List<Vertex> vertices, Vertex vertex) {
-        Assert.assertTrue(Utils.contains(vertices, vertex));
-    }
 }
diff --git 
a/hugegraph-client/src/test/java/org/apache/hugegraph/functional/HugeClientHttpsTest.java
 
b/hugegraph-client/src/test/java/org/apache/hugegraph/functional/HugeClientHttpsTest.java
index ab84ad27..b5357512 100644
--- 
a/hugegraph-client/src/test/java/org/apache/hugegraph/functional/HugeClientHttpsTest.java
+++ 
b/hugegraph-client/src/test/java/org/apache/hugegraph/functional/HugeClientHttpsTest.java
@@ -32,7 +32,7 @@ import org.junit.Test;
 
 import com.google.common.collect.ImmutableMap;
 
-public class HugeClientHttpsTest {
+public class HugeClientHttpsTest extends BaseFuncTest {
 
     private static final String BASE_URL = "https://127.0.0.1:8443";;
     private static final String GRAPH = "hugegraph";
@@ -48,7 +48,7 @@ public class HugeClientHttpsTest {
     private static HugeClient client;
 
     @Before
-    public void init() {
+    public void initBaseFuncTest() {
         CommonUtil.downloadFileByUrl(CommonUtil.PREFIX + 
"hugegraph.truststore", TRUST_STORE_PATH);
     }
 
@@ -60,7 +60,7 @@ public class HugeClientHttpsTest {
 
     @Test
     public void testHttpsClientBuilderWithConnection() {
-        client = HugeClient.builder(BASE_URL, GRAPH)
+        client = HugeClient.builder(BASE_URL, GRAPHSPACE, GRAPH)
                            .configUser(USERNAME, PASSWORD)
                            .configSSL(TRUST_STORE_PATH, TRUST_STORE_PASSWORD)
                            .build();
@@ -70,7 +70,7 @@ public class HugeClientHttpsTest {
 
     @Test
     public void testHttpsClientWithConnectionPoolNoUserParam() {
-        client = HugeClient.builder(BASE_URL, GRAPH)
+        client = HugeClient.builder(BASE_URL, GRAPHSPACE, GRAPH)
                            .configConnectTimeout(3)
                            .configReadTimeout(10)
                            .configPool(MAX_CONNS, MAX_CONNS_PER_ROUTE)
@@ -82,7 +82,7 @@ public class HugeClientHttpsTest {
 
     @Test
     public void testHttpsClientWithConnectionPoolNoTimeOutParam() {
-        client = HugeClient.builder(BASE_URL, GRAPH)
+        client = HugeClient.builder(BASE_URL, GRAPHSPACE, GRAPH)
                            .configUser(USERNAME, PASSWORD)
                            .configPool(MAX_CONNS, MAX_CONNS_PER_ROUTE)
                            .configSSL(TRUST_STORE_PATH, TRUST_STORE_PASSWORD)
@@ -93,7 +93,7 @@ public class HugeClientHttpsTest {
 
     @Test
     public void testHttpsClientNewBuilderWithConnectionNoPoolParam() {
-        client = HugeClient.builder(BASE_URL, GRAPH)
+        client = HugeClient.builder(BASE_URL, GRAPHSPACE, GRAPH)
                            .configUser(USERNAME, PASSWORD)
                            .configTimeout(TIMEOUT)
                            .configSSL(TRUST_STORE_PATH, TRUST_STORE_PASSWORD)
@@ -104,7 +104,7 @@ public class HugeClientHttpsTest {
 
     @Test
     public void testHttpsClientNewBuilderWithConnectionPool() {
-        client = HugeClient.builder(BASE_URL, GRAPH)
+        client = HugeClient.builder(BASE_URL, GRAPHSPACE, GRAPH)
                            .configUser(USERNAME, PASSWORD)
                            .configTimeout(TIMEOUT)
                            .configPool(MAX_CONNS, MAX_CONNS_PER_ROUTE)
@@ -117,7 +117,7 @@ public class HugeClientHttpsTest {
 
     @Test
     public void testHttpsClientNewBuilderZeroPoolParam() {
-        client = HugeClient.builder(BASE_URL, GRAPH)
+        client = HugeClient.builder(BASE_URL, GRAPHSPACE, GRAPH)
                            .configUser(USERNAME, PASSWORD)
                            .configTimeout(TIMEOUT)
                            .configPool(0, 0)
@@ -130,7 +130,7 @@ public class HugeClientHttpsTest {
     @Test
     public void testHttpsClientBuilderWithConnectionPoolNoParam() {
         Assert.assertThrows(IllegalArgumentException.class, () -> {
-            HugeClient.builder(BASE_URL, GRAPH)
+            HugeClient.builder(BASE_URL, GRAPHSPACE, GRAPH)
                       .configUrl(null)
                       .configGraph(null)
                       .configSSL("", "")
@@ -144,7 +144,7 @@ public class HugeClientHttpsTest {
     @Test
     public void testHttpsClientBuilderWithConnectionPoolNoGraphParam() {
         Assert.assertThrows(IllegalArgumentException.class, () -> {
-            HugeClient.builder(BASE_URL, GRAPH)
+            HugeClient.builder(BASE_URL, GRAPHSPACE, GRAPH)
                       .configGraph(null)
                       .configSSL("", "")
                       .build();
@@ -157,7 +157,7 @@ public class HugeClientHttpsTest {
     @Test
     public void testHttpsClientBuilderWithConnectionPoolZeroIdleTimeParam() {
         Assert.assertThrows(IllegalArgumentException.class, () -> {
-            HugeClient.builder(BASE_URL, GRAPH)
+            HugeClient.builder(BASE_URL, GRAPHSPACE, GRAPH)
                       .configIdleTime(0)
                       .build();
         }, e -> {
diff --git 
a/hugegraph-client/src/test/java/org/apache/hugegraph/functional/HugeClientTest.java
 
b/hugegraph-client/src/test/java/org/apache/hugegraph/functional/HugeClientTest.java
index 84c1249f..871bb762 100644
--- 
a/hugegraph-client/src/test/java/org/apache/hugegraph/functional/HugeClientTest.java
+++ 
b/hugegraph-client/src/test/java/org/apache/hugegraph/functional/HugeClientTest.java
@@ -24,13 +24,14 @@ import org.junit.Test;
 public class HugeClientTest {
 
     protected static final String BASE_URL = "http://127.0.0.1:8080";;
+    protected static final String GRAPHSPACE = "DEFAULT";
     protected static final String GRAPH = "hugegraph";
     protected static final String USERNAME = "admin";
     protected static final String PASSWORD = "pa";
 
     @Test
     public void testContext() {
-        HugeClient client = HugeClient.builder(BASE_URL, GRAPH)
+        HugeClient client = HugeClient.builder(BASE_URL, GRAPHSPACE, GRAPH)
                                       .configUser(USERNAME, PASSWORD)
                                       .configHttpBuilder(builder -> 
builder.followRedirects(false))
                                       .build();

Reply via email to