Tooling Resources

Postman resources

Postman is a widely-used collaboration platform for API development and testing. Using this third-party tool, you can easily test APIs with environments generated for your test platforms and imported testing collections of API queries.

Postman collections are comprised of REST, Document, or GraphQL schema and queries to run or test against one or more defined environments. The tool includes a collection runner testing utility for testing against query assertions embedded in the collection. Collections and environments can be imported or exported with Postman.

Using Postman

Prerequisites

  • Install Postman to run postman testing

Postman collections

For Stargate development, three collections that correspond to the documentation code examples are available:

Each collection lets you try out creation, insertion, and deletion of both data and schema, as required.

Postman environment configuration

To use the collections, you’ll need to download and configure a postman environment. Two environments are also available, one for the open-source Stargate docker image and one for DataStax Astra. A small amount of configuration is necessary in the single environment to set your parameters before use.

Stargate OSS

If you are using non-standard ports, you’ll need to change them in the Postman environment. You can also edit the JSON file directly, if you prefer.

Astra

There are three items that must be retrieved from the Astra dashboard and configured in the Postman environment:

  • ASTRA_DB_ID

  • ASTRA_DB_REGION

  • ASTRA_DB_APPLICATION_TOKEN

Open the environment in Postman and copy/paste in the appropriate values. You can also edit the JSON file directly, if you prefer.

GraphQL resources

The easiest way to get started with GraphQL is to use the built-in GraphQL playground.

Prerequisites

In Astra, go to the Connect tab for your database, choose GraphQL under the Connect using an API and you’ll see instructions for accessing the playground.

Add your application token to the HTTP HEADERS section at the lower lefthand corner of the GraphQL Playground window:

{"x-cassandra-token":"$AUTH_TOKEN"}

Using the GraphQL Playground

Once in the playground, you can create new schema and interact with the GraphQL APIs. The server paths are structured to provide access to creating and querying schema, as well as querying and modifying Astra DB for DSE data:

  • /graphql-schema

    • An API for exploring and creating schema, or Data Definition Language (DDL). For example, Astra DB for DSE has queries to create, modify, or drop tables, such as createTable, or dropTable.

  • /graphql-admin

    • An API for deploying GraphQL schema.

  • /graphql/<keyspace>

    • An API for querying and modifying data in your tables using GraphQL fields.

Swagger resources

The Swagger UI allows you to interact with the REST and Document APIs in a web browser.

Using the Swagger UI

In Astra, go to the Connect tab for your database, choose GraphQL under the Connect using an API and you’ll see instructions for accessing the playground. In a browser, you can connect at https://$ASTRA_CLUSTER_ID-$ASTRA_REGION.apps.astra.datastax.com/api/rest/swagger-ui/

BloomRPC resources

Prerequisites

Using BloomRPC

BloomRPC aims to provide the simplest and most efficient developer experience for exploring and querying your GRPC services. Using this third-party tool, you can easily test gRPC proto files with environments generated for your test platforms.

For instance, the proto files can be imported into BloomRPC. Select ExecuteQuery from the imported files. Set the environment to localhost:8090 if running a Stargate docker container. In the metadata, add an authentication token with {"x-cassandra-token": "<auth_token>"}. If you have followed one of the gRPC client instructions, add the following query and push the run button:

{
  "cql": "SELECT * FROM users",
  "values": {
    "type": 0
  },
  "parameters": {
    "keyspace": {
      "value": "test"
    }
  }
}

You should get the same results from the database table that you received running command-line tools.