Skip to main content

A terminal-first, interactive API client that brings Postman-like features into the CLI

Project description

apicrafter

A terminal-first, interactive API client that brings Postman-like features into the CLI. Built with modern Python tooling and designed for developers who prefer the command line.

✨ Features

  • 🌐 Full HTTP Support - GET, POST, PUT, DELETE, PATCH, HEAD, OPTIONS
  • 📝 Multiple Request Formats - JSON, Form data, Raw text, Custom headers
  • 🎨 Beautiful Output - Syntax highlighting for JSON, XML, HTML responses
  • 💾 Collections - Save and organize your API requests
  • 🌍 Environments - Manage dev/staging/prod configurations with variables
  • 🔄 Variable Substitution - Use {{VARIABLE}} syntax for dynamic values
  • 📚 Request History - Track all requests with timestamps and response times
  • 🧪 Basic Testing - Assertions for status codes, response content, and more
  • 🎯 Interactive Mode - Firebase CLI-style menus and prompts
  • High Performance - Built on httpx for fast, async-capable requests

🚀 Quick Start

Installation

pip install apicrafter-cli

Basic Usage

# Send a simple GET request
apicrafter send GET https://jsonplaceholder.typicode.com/posts/1

# Send a POST request with JSON data
apicrafter send POST https://httpbin.org/post \
  --header "Content-Type: application/json" \
  --data '{"title": "Hello", "body": "World"}'

# Interactive mode for guided request building
apicrafter interactive

📖 Core Commands

Send Requests

# Basic request
apicrafter send GET https://api.example.com/users

# With headers
apicrafter send POST https://api.example.com/users \
  --header "Authorization: Bearer token123" \
  --header "Content-Type: application/json"

# With JSON data
apicrafter send POST https://api.example.com/users \
  --data '{"name": "John", "email": "john@example.com"}'

# With form data
apicrafter send POST https://api.example.com/login \
  --form username=john \
  --form password=secret

# With query parameters
apicrafter send GET https://api.example.com/users \
  --param page=1 \
  --param limit=10

Collections Management

# Save a request to a collection
apicrafter save get-users \
  --method GET \
  --url "https://api.example.com/users" \
  --header "Authorization: Bearer {{TOKEN}}"

# Run a saved request
apicrafter run get-users

# List all collections
apicrafter collections

Environment Management

# Set environment variables
apicrafter env-set dev BASE_URL https://dev-api.example.com
apicrafter env-set dev TOKEN dev_token_123

# Run request with specific environment
apicrafter run get-users --env dev

Request History

# View request history
apicrafter history

# Replay a request from history
apicrafter replay 1

Testing

# Test a request with assertions
apicrafter test GET https://api.example.com/health \
  --assert-status 200 \
  --assert-json "status:healthy"

🔧 Configuration

apicrafter stores its configuration in ~/.apicrafter/:

~/.apicrafter/
├── collections.yaml    # Saved requests and collections
├── envs.yaml          # Environment variables
└── history.log        # Request history

Environment Variables

Use the {{VARIABLE}} syntax in your requests for dynamic values:

# In collections.yaml
- name: get-user
  method: GET
  url: "{{BASE_URL}}/users/{{USER_ID}}"
  headers:
    Authorization: "Bearer {{TOKEN}}"

📚 Documentation

For more detailed documentation, visit the GitHub repository.

🤝 Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

📝 License

This project is licensed under the MIT License - see the LICENSE file for details.

🙏 Acknowledgments

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

apicrafter_cli-0.1.7.tar.gz (45.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

apicrafter_cli-0.1.7-py3-none-any.whl (49.8 kB view details)

Uploaded Python 3

File details

Details for the file apicrafter_cli-0.1.7.tar.gz.

File metadata

  • Download URL: apicrafter_cli-0.1.7.tar.gz
  • Upload date:
  • Size: 45.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for apicrafter_cli-0.1.7.tar.gz
Algorithm Hash digest
SHA256 1fc8e319be4a329110bf08f9c2ffb4903947d693cea7b077b4895b49dd1429f4
MD5 cda100598bc0d857c97aeb429a9dc365
BLAKE2b-256 3802963162e6c88dbf69465cfd1306895b57a71e5891be7c428b2c5bc344e767

See more details on using hashes here.

File details

Details for the file apicrafter_cli-0.1.7-py3-none-any.whl.

File metadata

  • Download URL: apicrafter_cli-0.1.7-py3-none-any.whl
  • Upload date:
  • Size: 49.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for apicrafter_cli-0.1.7-py3-none-any.whl
Algorithm Hash digest
SHA256 53738081c84ccbf75d957ad3cbe670d329350696f555e5cd24768982f846a931
MD5 d58a970b9e49ea3787712ee582fd8e21
BLAKE2b-256 efcf6db73d84c158e846bedfa527b691bbe695493bfb91e9807fdc8139623569

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page