Jump to Content
Application Development

Faster API development with the Cloud Code plugin for API management

July 10, 2024
https://storage.googleapis.com/gweb-cloudblog-publish/images/1_jHrBQje.max-2500x2500.jpg
Emanuel Burgess

Developer Advocate, Google

Try Gemini 1.5 models

Google's most advanced multimodal models in Vertex AI

Try it

Developers are at the heart of API delivery, and they need tools that make the process faster and easier. Apigee is a powerful API management platform that helps enterprises build, manage, monetize and scale APIs with tools that help developers simplify and speed up API development.

Apigee is accessible in the Google Cloud console, as well as via most commonly used IDEs via the Cloud Clode plug-in. With the Cloud Code plugin in VSCode, developers can create workspaces, build proxies, and even leverage Gemini Code Assist to streamline API delivery. To better understand the plug-in let’s first take a closer look at a workspace.

Workspace for organization

A workspace in Apigee is a collection of folders that is automatically created to help you develop APIs. Workspaces save time by providing you with a structured starting point to leverage all the tools you need for API development in one location. A workspace consists of:

  • API proxy: Proxies consist of a proxy endpoint (your API URL) and a target endpoint (connection point to your backend service). A proxy decouples your API from your backend. Additionally, you can enhance your proxy by extending functionality and management capabilities using policies which can be attached at different points as messages flow through your proxy. 

  • Shared flow: A shared flow allows you to reuse common functionality like policies and resources across multiple APIs within an organization. 

  • Environments: An environment is a dedicated space for creating, testing and deploying API proxies. 

  • Test data: Test data allows you to bundle together a set of common resources that a developer might see in a production environment. Things like API products, developer accounts, test developer applications and values that your API would need to function. 

  • Emulators: Emulators allow you to verify the functionality through unit and manual testing using a docker image (local runtime).

Gemini Code Assist for API management (Preview)

https://storage.googleapis.com/gweb-cloudblog-publish/images/2_TeZS3jx.max-1000x1000.png

Gemini Code Assist unlocks the power of generative AI to help you build great software. Create an Open API specification from requirements that you describe in natural language within seconds, all from within the Cloud Code plugin. With tight integration with API Hub, you can register these specifications right from the plugin.

Harnessing the power of Gemini Code Assist starts with a prompt. A prompt allows you to describe your API specification in natural language. Gemini Code Assist offers contextual AI assistance because it understands objects in your organization's API hub, which it uses to generate a tailored specification response in seconds based on your business requirements. It does this by reusing objects, metadata and security schemas from specifications that are already registered in your organization's API hub, promoting consistency across all of your APIs. 

Let’s say you want to create an API for placing new orders. In your prompt you may write, “Create an API for placing new orders.” Gemini then takes a look at all the APIs registered in API Hub and uses those business requirements to generate a draft. In the specification, Gemini pulls objects and schemas from the APIs in your registry to match the business requirements of other APIs. You can then refine the prompt until you get my desired specification using the editor. Additionally you can even see your prompt history all from the same screen.

Mock servers for increased velocity

https://storage.googleapis.com/gweb-cloudblog-publish/original_images/3_MDVKZNg.gif

Testing is a vital part of the API development process. The Cloud Code Plugin allows you to not only develop APIs but also test them locally or with others. Whenever an API specification is generated, a local mock server is also created alongside the specification. You can interact with your API from within the same UI you created your specification. Additionally you can modify parameters and insert mock values to simulate common scenarios and use cases. These auto generated mock servers allow for faster functionality verification of your API proxies.

In addition, you can easily deploy such a mock server to your Google Cloud project with a simple workflow. When you deploy your mock server to the cloud, you can share it with others on your team, speeding up the process of collecting feedback. For example, you as a service developer may share a mock service with your front-end counterparts who can try out the service before you write a single line of code implementing the API. 

Get started

Ready to build and deploy an API with the Cloud Code plugin? Click here to get started. With Gemini Code Assist for API management you can reimagine API development.

Posted in