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
Postman collections can accessed in the Stargate-Cassandra workspace hosted on postman.com. You can either run the collections in the workspace, export the collections to use in your own postman application, or run the collections using the btn:(Run in Postman).
For Stargate development, four collections that correspond to the documentation code examples are available:
-
REST API
-
Postman Workspace: REST API collection
-
-
Document API
-
Postman Workspace: Documentation API collection
-
-
GraphQL API
-
Postman Workspace: GraphQL API collection
-
-
gRPC API
-
Postman Workspace: gRPC API collection
-
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 DB
There are three items that must be retrieved from Astra Portal 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
The GraphQL playground launches the url http://localhost:8080/playground
in your browser.
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 Stargate data:
-
/graphql-schema
-
An API for exploring and creating schema, or Data Definition Language (DDL). For example, Stargate has queries to create, modify, or drop tables, such as
createTable
, ordropTable
.
-
-
/graphql-admin
-
An API for deploying GraphQL schema.
-
-
/graphql/<keyspace>
-
An API for querying and modifying data in your tables using GraphQL fields.
-
REST and Document API resources
The Swagger UI allows you to interact with the REST and Document APIs in a web browser.
Using the Swagger UI
Once you have started Stargate using Docker, you can access the REST API in a browser at http://localhost:8082/swagger-ui. For the Document API, use http://localhost:8180/swagger-ui. You can use the "Try It" function to execute and display results. You can also use this function to generate cURL commands to execute on the command line.
BloomRPC gRPC resources
Prerequisites
-
Install BloomRPC to run gRPC testing
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.