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

Uploaded Python 3

File details

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

File metadata

  • Download URL: api_rester-0.3.7.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.7.tar.gz
Algorithm Hash digest
SHA256 3f2d5711cfe51dca2838d7466c61e5b3feaefcf7323a1c93d60c73a7bc46c1ea
MD5 aed554fe1f40cd5ca54a3a2f043ecca7
BLAKE2b-256 1b90959e5d0eb1c4288980f4ee9c2192805efbcaafe9130717b469d435842d44

See more details on using hashes here.

File details

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

File metadata

  • Download URL: api_rester-0.3.7-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.7-py3-none-any.whl
Algorithm Hash digest
SHA256 112aa65ecfa85f56f6b215d91cb2dd3154e6c1694b3cd7fc47705d5aca9deb9b
MD5 50158ee27d499be295341990fccfde49
BLAKE2b-256 90cec0544ea1e8f5904ad13e0a95b85c1c69c9707cad9f7b1b814da3ef61010b

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