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.5.tar.gz (8.9 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.5-py3-none-any.whl (11.3 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: api_rester-0.3.5.tar.gz
  • Upload date:
  • Size: 8.9 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.5.tar.gz
Algorithm Hash digest
SHA256 05581011e71aeab22aa07fb6a9a0d5de0b8f9f7d2c7ba95405575aa912d354f1
MD5 92532b8d77fc6a169778e930a904a138
BLAKE2b-256 b1ab4dd577fe2e5f2c3a76970403bdeeb712e7bbc389f5fa10ab49ebf37759b3

See more details on using hashes here.

File details

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

File metadata

  • Download URL: api_rester-0.3.5-py3-none-any.whl
  • Upload date:
  • Size: 11.3 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.5-py3-none-any.whl
Algorithm Hash digest
SHA256 30e167dca3b1df91609f53aabfb4c51e994894b74bf9e4f5019fddc81f9f4136
MD5 25cf33ba81eb52ba2ccc5cb38676f07d
BLAKE2b-256 cc5c3b87745039bc3c894307b45a893090021dbb176c47f28f1a7f0a8af79a77

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