Design APIs

Learn to design APIs within Requestly: Define Paths, create collections, import APIs, and use variables.

API builder in Requestly helps you define and organise your APIs with ease. You can further use these definitions to test APIs and develop your applications. This guide will walk you through the API Designing process within Requestly, which includes defining API Requests, managing APIs with collections, importing APIs, and using variables.

API Builder

The API Builder in Requestly helps you design APIs, manage them using collections, and streamline workflows with variables. Let’s first explore the interface of the API Builder.

  • To start creating APIs, click the + New button at the top left of the API Builder. This provides three options:

  • The Import button allows you to import APIs from cURL, Requestly Collections, or Postman Collections.

  • Next to the Import button is the Environment Switcher, which lets you switch between environments.

  • On the left sidebar, you’ll find three icons:

    1. Collections: Displays the list of API Collections and API Requests in the current workspace.

    2. Environments: Shows the list of created environments.

    3. History: Logs all API requests sent so far for easy reference.

Create API Request

An API Request can be created in two ways: using the + New button on the top left or from within a collection. The request creation process remains the same after that:

Step 1: Name the request (e.g., “Create User”) for easy identification.

Step 2: Select the HTTP method (e.g., POST) and enter the API URL. You can use variables (explained below) to define a root URL and reference the variable in each API request.

Step 3: Define query parameters under the Query Parameters tab using a simple key-value format. Checkboxes allow you to disable specific query parameters when sending the request.

Step 4: Add headers under the Headers tab. Similar to query parameters, headers are defined as key-value pairs.

Step 5: Use the Body tab to define the request body in one of three formats: Raw, JSON, or Form. This option is not available for GET & HEAD request due to the nature of these requests.

Step 6: Save the request.

You can also enhance your API requests with Scripts, which allow you to execute pre-request and post-response logic for custom workflows.

Create API Collection

In projects requiring a large number of APIs, organizing them into groups is essential. API Collections allow you to group related APIs together for better structure and manageability. For instance, you can organize APIs by functionality (e.g., Auth, User Management, Payment) or by services in a microservices architecture (e.g., User Identity Service, Payment Service).

Step 1: Click + New and select Collection.

Step 2: Provide a descriptive name (e.g., “User Management APIs”) and press Enter.

For more details, refer to the API Collections section.

Import APIs & Collections

Requestly makes API design simple by allowing you to import APIs from various sources. This feature is invaluable for integrating existing workflows or migrating from other tools.

Supported Imports:

cURL Commands: Paste a cURL command into the API Client to instantly convert it into a request.

Requestly API Collections: Import existing collections from another Requestly account for continuity.

Postman Collections: Import APIs from Postman with 1-Click. Learn more about Postman Imports.

This flexibility ensures you can quickly set up your API workspace without starting from scratch.

Variables in APIs

Requestly supports variables in two forms — Collection Variables and Environment Variables. Variables simplify managing repetitive or shared parts of APIs, such as base URLs or API keys. For example, multiple APIs can share the same base URL or authentication token.

Variables can be defined in environments and used in API requests by enclosing them in double curly braces, e.g., {{base_url}}.

Learn more about Variables and how to use them effectively in your APIs.

Updated on