PitchHut logo
The terminal-based API client for all your HTTP needs.
Pitch

yapi is a CLI-first, offline-first API client tailored for developers. With support for HTTP, gRPC, and TCP, it simplifies API interactions by using simple YAML files. Stop relying on bulky GUI tools and embrace a more efficient way to define, review, and run API requests directly from your terminal.

Description

yapi is an innovative CLI-first and offline-first API client designed for ease of use within terminal environments and integration with Git repositories. This tool facilitates interactions with HTTP, gRPC, and TCP protocols without the overhead of traditional GUI applications. By leveraging simple YAML files to define requests, yapi empowers users to commit, review, and execute API calls seamlessly.

Key Features

  • Terminal-Based Convenience: Navigate and execute API requests directly from the terminal, streamlining workflows and improving efficiency.
  • YAML Configuration: Requests are defined using straightforward YAML syntax, making them easy to read and manage.
  • Environment Management: Define multiple environments (development, staging, production) within a single configuration file, simplifying the management of configurations and secrets.
  • Request Chaining: Build complex authentication flows and multi-step workflows by chaining together multiple requests with data passed between steps.
  • Interactive TUI: Utilize the interactive terminal user interface to quickly search through .yapi.yml files and execute them on the fly.
  • Load Testing: Stress test workflows with concurrent execution, enabling realistic load testing across multi-step processes.
  • Continuous Integration/Continuous Deployment (CI/CD) Support: Integrate with GitHub Actions to automate testing and service orchestration, ensuring robust workflows.

Usage Examples

Quick Start

Create a request file (e.g., get-user.yapi.yml) and run:

# Request Definition
yapi: v1
url: https://jsonplaceholder.typicode.com/users/1
method: GET
yapi run get-user.yapi.yml

Request Chaining

Here's an example of chaining requests:

# Chained Requests
yapi: v1
chain:
  - name: login
    url: https://api.example.com/auth/login
    method: POST
    body:
      username: "dev_sheep"
      password: ${PASSWORD}
    expect:
      status: 200
      assert:
        - .token != null
  - name: create_post
    url: https://api.example.com/posts
    method: POST
    headers:
      Authorization: Bearer ${login.token}

Advanced Assertions

Validate complex response structures using assertions powered by JQ:

# Assertion Example
yapi: v1
url: https://api.example.com/users
method: GET
expect:
  status: 200
  assert:
    - . | length > 0
    - .[0].email != null

Editor Integration

yapi includes a comprehensive Language Server Protocol (LSP) implementation, enabling real-time validation, intelligent autocompletion, and an enhanced API development experience across compatible editors.

Get Started

Explore the Playground to test yapi in action or View Source for more details.

By embracing yapi, developers can easily create, execute, and manage API requests efficiently, making it an essential tool in modern development workflows.

0 comments

No comments yet.

Sign in to be the first to comment.