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

Uploaded Python 3

File details

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

File metadata

  • Download URL: api_rester-0.3.4.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.4.tar.gz
Algorithm Hash digest
SHA256 9e28be46fc2176610fefaafa66248efc484498f2541844d9fd44780f53b15153
MD5 8320e84be2d49a431886e833b6b65d7e
BLAKE2b-256 5d90cb550bc76f25976793892557f60cda13c812979b3fdbd4589849af95c633

See more details on using hashes here.

File details

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

File metadata

  • Download URL: api_rester-0.3.4-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.4-py3-none-any.whl
Algorithm Hash digest
SHA256 f1af65be4d2d251eeb3a0d9720808e6492373e4abaf2b3284ed7e9afb44d1059
MD5 bb207be9b1801b81b119852b4d1f5067
BLAKE2b-256 03ab4740c80528332cbfa43c0628167a859e1ff1b8e629940abcee568273e051

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