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.2.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.2-py3-none-any.whl (11.2 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: api_rester-0.3.2.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.2.tar.gz
Algorithm Hash digest
SHA256 0d4e9ec6883fd448e2248ef248712726c69d261bef0733c3ffe7640756ebe955
MD5 2d172cd65509d6359b52768f3ad413ac
BLAKE2b-256 4bfa0301bde8356c193a7b33057c08665b5dcfb6a2a79531945bda5ac1c32cf0

See more details on using hashes here.

File details

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

File metadata

  • Download URL: api_rester-0.3.2-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.2-py3-none-any.whl
Algorithm Hash digest
SHA256 69c98b8141159e7cbab068631e3d91248102d6f113392df38bb73939c7735e66
MD5 9b395d1b86e42a6ffc60451568f82666
BLAKE2b-256 09d26aa57f36fd7e4b64445dd739c4eaa1084e67b879149803aed67fc04256f5

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