Skip to main content

A simple REST API client CLI utility

Project description

Api Rester 🚀

A lightweight, user-friendly command-line REST client that lets you test APIs without the overhead of GUI applications like Postman or Insomnia. Perfect for developers who prefer staying in their terminal!

Installation 📥

Install Api Rester using pip:

pip install api-rester

Why Api Rester? ✨

Api Rester provides a streamlined way to test APIs directly from your terminal:

Core Features:

  • Make API calls using JSON files for requests and responses
  • Support for common HTTP methods (GET, POST, PUT, DELETE, HEAD, PATCH)
  • Handle query parameters and headers
  • Environment variable substitution from .env files
  • Configurable verbose logging for debugging

Request/Response Handling:

  • Store and validate requests/responses as JSON
  • Validate domains and paths
  • Safe handling of HTTP headers
  • Support for alternative request/response files

Cookie Management:

  • Persistent cookie storage between requests
  • Cookie validation and security checks

Getting Started 🎯

1. Create Your First Request

Create a request.json file:

{
    "protocol": "https",
    "host": "api.example.com",
    "path": "/api/v1/users",
    "method": "POST",
    "headers": {
        "Content-Type": "application/json"
    },
    "body": {
        "name": "John Doe",
        "email": "john.doe@example.com"
    }
}

2. Make the Call

api-rester call

3. Check the Response

Api Rester saves the response in response.json:

{
    "status": 200,
    "headers": {
        "Content-Type": "application/json"
    },
    "body": {
        "id": 59,
        "name": "John Doe",
        "email": "john.doe@example.com" 
    }
}

Advanced Features

Custom File Names

Need to use different file names? No problem:

api-rester call --request-file custom-request.json --response-file custom-response.json

Environment Variables

Use environment variables in your requests with ${{VARIABLE_NAME}} syntax:

{
    "headers": {
        "Authorization": "Bearer ${{API_KEY}}"
    }
}

Run it with:

API_KEY=your_key_here api-rester call

Query Parameters Made Easy

Add query parameters that are automatically encoded:

{
    "protocol": "https",
    "host": "api.example.com",
    "path": "/search",
    "method": "GET",
    "queryParams": {
        "q": "search term",
        "filter": ["active", "verified"]
    }
}

Smart Cookie Management

Cookies are automatically handled between requests and stored in cookies.json. They're automatically sent with matching domain requests - just like a browser would do!

Debug Mode

Need to see what's happening? Use verbose mode:

api-rester call --v

Quick Cleanup

Clean up generated files:

api-rester clear

Or specify custom files to clear:

api-rester clear --req custom-request.json --res custom-response.json --cookies custom-cookies.json

Generate Request Templates

Start with a template to save time:

api-rester template --filename my-request.json

Coming Soon 🔜

  • Request timeouts
  • Stdin/Stdout support for piping: python seeder-script.py | api-rester call | bash analytics-script.sh

License 📄

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

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

api_rester-0.3.3.tar.gz (8.8 kB view details)

Uploaded Source

Built Distribution

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

api_rester-0.3.3-py3-none-any.whl (11.2 kB view details)

Uploaded Python 3

File details

Details for the file api_rester-0.3.3.tar.gz.

File metadata

  • Download URL: api_rester-0.3.3.tar.gz
  • Upload date:
  • Size: 8.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.2

File hashes

Hashes for api_rester-0.3.3.tar.gz
Algorithm Hash digest
SHA256 c3fd62dfd694b1d3599124d64441f942fdee8021e9c009e11d3401132eab714c
MD5 5a2993b54507bbba3f646e6aeea72e87
BLAKE2b-256 3eced43ed2450337885bf2565ece65dbaa6f2127ed6cf666705f9ce521ad1ddc

See more details on using hashes here.

File details

Details for the file api_rester-0.3.3-py3-none-any.whl.

File metadata

  • Download URL: api_rester-0.3.3-py3-none-any.whl
  • Upload date:
  • Size: 11.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.2

File hashes

Hashes for api_rester-0.3.3-py3-none-any.whl
Algorithm Hash digest
SHA256 75950fe8773e4dd987cd7998589c03804f1d7f31c97944a62b282fd7dd1cae96
MD5 d02e36e91400ce9c17828a71fa43330b
BLAKE2b-256 4eecc8a915438d0eb19b0f28c1ce1d2a186e6c46595a51fcb4cb447953780ff4

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