blob: e2871c4c6d5a14f428c96599ed4bd89124ac7709 [file] [log] [blame]
// 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.
= REST API
The Ignite 3 clusters provide an link:https://www.openapis.org/[OpenAPI] specification that can be used to work with Ignite 3 by standard REST methods.
== REST Connector Configuration
By default, rest connector starts on port 10300. THis port can be configured in the `ignite.rest` link:administrators-guide/config/node-config#rest-configuration[node configuration].
== Using HTTP Tools
Once the cluster is started, you can use external tools to monitor the cluster over http, or manage the cluster. In this example, we will use link:https://curl.se/[curl] to get cluster status:
[source, bash]
----
curl 'http://localhost:10300/management/v1/cluster/state'
----
You are not limited to only monitoring, as Ignite REST API provides endpoints that can be used to manage the cluster as well. For example, you can create a link:administrators-guide/snapshots/snapshots-and-recovery[snapshot] via REST:
[source, bash]
----
curl -H "Content-Type: application/json" -d '{"snapshotType": "FULL","tableNames": "table1,table2","startTimeEpochMilli": 0}' http://localhost:10300/management/v1/snapshot/create
----
== Java Project Configuration
If you want to integrate Ignite REST API closer into your application, we recommend using an link:https://github.com/OpenAPITools/openapi-generator[OpenAPI generator] to generate a Java client. Once the client is generated, you can use it to work with REST API from code, for example:
[source,java]
----
ApiClient client = Configuration.getDefaultApiClient();
// Set base URL
client.setBasePath("http://localhost:10300");
// Get cluster configuration.
ClusterConfigurationApi clusterConfigurationApi = new ClusterConfigurationApi(client);
String configuration = clusterConfigurationApi.getClusterConfiguration();
----