LATEST VERSION: 8.2.7 - CHANGELOG
Pivotal GemFire® v8.2

Using the Swagger UI to Browse REST APIs

Using the Swagger UI to Browse REST APIs

Pivotal GemFire Developer REST APIs are integrated with the Swagger™ framework. This framework provides a browser-based test client that allows you to visualize and try out GemFire REST APIs.

Swagger application JARs are included in the GemFire REST application WAR; you do not need to install any additional libraries to use Swagger.

The following example demonstrates how to access the Swagger UI to browse the APIs.

  1. Start a GemFire Developer REST API-enabled server and JMX Manager as described in Setup and Configuration. For example:
    gfsh>start server --name=server1  --J=-Dgemfire.start-dev-rest-api=true \
    --J=-Dgemfire.http-service-bind-address=localhost \
    --J=-Dgemfire.jmx-manager=true --J=-Dgemfire.jmx-manager-start=true
    If desired, you can specify a different HTTP port for the developer REST service. For example, -J=-Dgemfire.http-service-port=8080. If you do not specify this property, the service is available at the default port 7070.
  2. To access Swagger, open a browser and enter the following URL: For example:
    http://localhost:7070/gemfire-api/docs/index.html
    The following Web page appears:
  3. In gfsh, connect to the server running the JMX Manager.
    gfsh>connect --jmx-manager=localhost[1099]
  4. Using gfsh, create one or more regions on the REST API server. For example:
    gfsh>create region --name=region1 --type=REPLICATE --key-constraint=java.lang.String
    Member  | Status
    ------- | ------------------------------------------
    server1 | Region "/region1" created on "server1"
    
  5. In Swagger, click on region : region to list all the available endpoints for accessing regions.
  6. In the list of region endpoints, click on the GET /v1 endpoint link. The page displays additional request and response information about the API.
  7. Click the Try it out! button. Any regions you added in step 5 are returned in the response body.
  8. Add an entry to the region by expanding the POST /v1/{region} endpoint.
  9. Click the Try it out! button to see the response body and response code.

You can use the Swagger interface to try out additional GemFire API endpoints and view sample responses.

For more information on Swagger, see https://helloreverb.com/developers/swagger and the Swagger Specification at https://github.com/wordnik/swagger-spec/.