Join our - Lead the Future of API Dev: A New Approach with Blackbird -Webinar on September 19thRegister Now

Back to blog
API DEVELOPMENT

How Mocking Against a Public API Endpoints within Blackbird Gets your API in Production Faster

Alicia Petit
September 19, 2024 | 5 min read
Mocking Against a Public API Endpoints

Mocking APIs in Blackbird is fast, and our newest enhancement lets you mock against popular API specs instantly, either in your browser or with the Blackbird CLI. Let’s review an example of when you would want to mock against a popular public API.

Adding an AI Chatbot using OpenAI API

Let’s say you are a developer working on the frontend code for a fintech company that specializes in helping you create healthy spending habits, including budgeting for your goals. You’ve been tasked with creating an interactive AI chatbot that helps users develop a budget based on their spending habits. To do this, you have decided to integrate OpenAI’s API into your product.

Scenario 1: Mocking Takes Too Long - You Plan to Skip It

Pros: Feels like you’ve made progress instantly because you’ve “skipped” a step

Cons: Costly in many ways – from dev time to cloud spend

API Mocking can be hard to set up or too time-consuming when you’re not using a good mocking tool, fueling the urge to skip this step completely. Let’s play that scenario out. If you decide not to mock at all, you’ll have to go to OpenAI’s dev site and sign up for a paid plan without having tested your frontend code against it at all, throwing it straight into your cloud, which adds even more cost to just get the API up and running.

Scenario 2: You Have Your Own Mocking Tool that You Already Plan to Use

Pros: You’re used to this process

Cons: Your current process has a lot of limitations:

  • Time and Resource Investment: Developing a custom solution requires significant time, effort, and resources.
  • Maintenance Overhead: Once developed, the tool will need to be maintained, updated, and secured. This can be a burden on the development team.
  • Potential for Errors: Custom development introduces the risk of bugs and errors that may not be caught until later in the development process.
  • No Community Support: Unlike established tools like Blackbird, custom solutions may have limited to no community support and documentation.

You’re interested in mocking to make sure you are getting what you need before paying for the OpenAI API. You already have a mocking tool in place that your team has built and you’re already familiar with, making this as straightforward for you to get going. The only thing standing in your way is the DevOps queue – you’ll have to wait until they can get you an environment up and running. You’ve already moved onto your next Jira ticket when they get back to you, and now you have to switch gears (again).

Scenario 3: You Want to Mock your OpenAI API with Blackbird

Pros: You can mock in seconds against the OpenAI API in Blackbird.

Cons: You’ve never used it before, so you’re not sure how it really works

As a first time user of Blackbird, you’re learning as you go. You login, start developing an API. You have the option to import a spec if you have one, or create one with the chatbot. In addition, Blackbird API Development has a library of public specs (e.g. Stripe, Slack, Spotify) enabling you to spin up a mock instantly. You’ve saved on cloud costs in your own infrastructure and saved on paying for access to the OpenAI API before you knew if it could meet your needs.

Reduce Spend by Mocking APIs with Blackbird

We’ve looked at three common scenarios when it comes to mocking an API you want to use within your product. There are two primary drivers to this cost savings: time spent building, testing, and deploying your API and the fixed costs of accessing that tool’s API and the cloud costs associated with testing in your own infrastructure. By mocking efficiently within your own inner dev loop using Blackbird API development tool and not having to include DevOps to help you set up (and pay for) your own homegrown mocking infrastructure, you get the benefits of having a production-ready API on your own timeline.

Currently Available APIs for Instant Mocking within Blackbird:

OpenAI

The OpenAI API provides an interface to AI models for natural language processing, image generation, semantic search, and speech recognition.Quickstart can be found here: https://platform.openai.com/docs/quickstart

Twitter

The X API enables programmatic access to X. Elements that can be utilized are: Posts, Direct Messages, Spaces, Lists, users, and more.

ShopifyAdmin

The Shopify Admin API provides a way to create integrations and applications that improve and expand the Shopify admin.

Slack

The Slack API enables programmatic access to create custom apps, workflows, and share data two-way. Information can be queried from and changes can be made to a Slack workspace.

Zoom

Zoom API provides access to interface with Zoom products. Some of the products that can be programmatically accessed are: Meeting, Account, User, Zoom Phone, Contact Center, Video SDK, Team Chat and Chatbot and more.