Get a Head Start on Your App Development with Flexible DataStax Stargate APIs

Doug Wettlaufer - Jun 9 '22 - - Dev Community

Image description

This is the introductory blog to explain our upcoming series about the Stargate Data APIs. Each post will take you on a deeper dive into how each application's programming interface (API) works and what you’ll want to use it for.

If you want to build an enterprise-level app that can handle as much data as Apple, Netflix, or Capital One, you’ll need to run it on Apache Cassandra® as they do.

But you no longer have to have a huge team of developers. We’ve created the project Stargate to help you. Stargate is an open-source data gateway that brings together your app and databases by helping to abstract Cassandra-specific concepts from app developers. It’s also an important part of DataStax Astra DB, our multi-region, multi-cloud, serverless database service built on Apache Cassandra.

With the three Stargate APIs, REST, Document, and GraphQL, you have all you need to manage your Cassandra database without having to build your own Cassandra-specific interface.

How you will benefit from the Stargate Data APIs

Image description

Figure 1: The most common DataStax API on Stargate — REST API — lets apps run seamlessly with Cassandra in addition to any relevant microservices.

It can be challenging to work out exactly how to retrieve and update data when you’re working on a new app. You may want to pull from several microservices like payments, analytics, and a user action log.

Instead of having to sort through drivers or even code your own interface between all of your moving parts and your database, you can continue to use APIs and technologies you’re already familiar with (like REST) via the Stargate APIs.

They will let you set up the interface between your app and its data in a Cassandra database with minimal work on your behalf. Even if your app is already up and running.

You’ll get all the benefits of scalability without the hazard of your interface breaking down when your app starts to attract a lot of users. Plus you won’t have to deal with the other common concerns like health checks, metrics, or authentication as these are all provided out of the box.

Be up and running in seconds with the Stargate REST API

REST APIs have become very popular because they effectively cover the needs for basic HTTP operations.

With the Stargate REST API, you get the most popular, well-known interface with a Cassandra database that’ll work no matter how big your app grows to be. You can use it to get a clean separation between your app and the server that holds your data.

Image description

Figure 2: DataStax Stargate REST API comes with all Astra databases. You can set one up for free at astra.datastax.com.

Since you’re probably already familiar with REST APIs, you can get up and running in seconds with the Stargate REST API. To start, simply set up a database for free in DataStax Astra DB.

You can use the Stargate REST API to cover a wide range of use cases. For example, managing a product catalog and keeping it up to date with the amounts of each product in stock. Or letting librarians search for and suggest new books based on the authors or genres each visitor likes.

You can do a lot of great work with the REST API. But one of the challenges is that you can’t control the amount of data that is returned from the database. So if you need a truly scalable app that draws on the relationships between data, you’ll want to know about the GraphQL API.

Only get the data you need with the Stargate GraphQL API

You might not be building one of the world’s largest social networks, but you can still enjoy the same technology that lets Facebook handle a large number of datasets.

Developers at Facebook created GraphQL to get just the pieces of data needed in every instance and make it easy to understand. That’s how we know the Stargate GraphQL API will also work for you.

Without this API, this task could end up as an insurmountable mess when your app starts to gain traction with users. But with the GraphQL API, you can simply set it up to retrieve exactly the data you need from the start. This saves you a lot of complexity and bandwidth.

Image description

Figure 3: DataStax Stargate GraphQL API comes with all Astra databases. You can set one up for free at astra.datastax.com.

The biggest disadvantage to GraphQL is that the possibilities can seem overwhelming. That’s why we created a thorough GraphQL API demo that helps you start using it with Stargate.

Be sure to read our second blog post in this series to learn more about what makes the GraphQL API so great to work with and just how to make it work for you.

Don’t worry about the schema — just use the Document API

Modern applications are built on APIs, and JSON documents are the most common way of expressing data payloads on those APIs. Stargate Document API makes it easy to serve a document-style API directly from any Cassandra database, allowing you to store and retrieve JSON documents without defining a database schema. This is a big deal because the traditional practice for Cassandra has been to define all your schema upfront.

Image description

Figure 4: DataStax Stargate Document API comes with all Astra databases. You can set one up for free at astra.datastax.com.

Document API serves up all your data as JSON documents and lets you interact with them in the most familiar HTTP methods. It also lets you represent the data just like you want it in your app. You can use this API to create, update, and retrieve documents and subdocuments.

You can get started using Document API now or read on in our third and final post in this series about the benefits and technology within our Document API.

For exclusive posts on all things data: Cassandra, streaming, Kubernetes, and more; follow DataStax on Medium.

References:

  1. What is Astra DB? (Astra documentation)
  2. Getting started with DataStax Astra DB
  3. Stargate APIs | GraphQL, REST, Document
  4. Join our Discord: Fellowship of the (Cassandra) Rings
  5. DataStax Academy
  6. DataStax Certifications
  7. DataStax Workshops
  8. DataStax for Developers
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .