GridGain Developers Hub

REST API

The GridGain 9 clusters provide an OpenAPI specification that can be used to work with GridGain 9 by standard REST methods. The online specification is provided with each release.

We recommend that you generate client code in your project language by using an OpenAPI code generator. Below is the example of how you can do this for a Java project.

Getting Started

You do not need to explicitly configure REST on the cluster. The connector starts up automatically and listens on port 10300. You can check if it works with curl:

curl 'http://localhost:10300/management/v1/cluster/state'

Add the ignite-cli library to your pom.xml file:

<dependency>
    <groupId>org.gridgain</groupId>
    <artifactId>ignite-rest</artifactId>
    <version>${gridgain.version}</version>
</dependency>

Java Project Configuration

  1. Add an open api generator maven plugin to your project’s pom.xml file.

    <plugin>
      <groupId>org.openapitools</groupId>
      <artifactId>openapi-generator-maven-plugin</artifactId>
      <version>${maven.openapi.plugin.version}</version>
      <executions>
        <execution>
          <goals>
            <goal>generate</goal>
          </goals>
          <configuration>
            <inputSpec>https://github.com/apache/ignite-3/tree/main/modules/rest-api/openapi/openapi.yaml</inputSpec>
            <generatorName>java</generatorName>
            <apiPackage>org.apache.ignite.rest.client.api</apiPackage>
            <invokerPackage>org.apache.ignite.rest.client.invoker</invokerPackage>
            <modelPackage>org.apache.ignite.rest.client.model</modelPackage>
            <generateModelTests>false</generateModelTests>
            <generateApiTests>false</generateApiTests>
            <languageSpecificPrimitives>true</languageSpecificPrimitives>
            <configOptions>
              <openApiNullable>false</openApiNullable>
              <supportStreaming>false</supportStreaming>
            </configOptions>
            <library>okhttp-gson</library>
          </configuration>
        </execution>
      </executions>
    </plugin>
  2. Get cluster configuration from your project.

    ApiClient client = Configuration.getDefaultApiClient();
    // Set base URL
    client.setBasePath("http://localhost:10300");
    
    // Get cluster configuration.
    ClusterConfigurationApi clusterConfigurationApi = new ClusterConfigurationApi(client);
    String configuration = clusterConfigurationApi.getClusterConfiguration();