cutieAPI is a Python-based, interactive command-line tool designed to make API testing and interaction easy and enjoyable, right from your terminal! It's built with Rich for beautiful terminal output and requests for robust HTTP communication.
Think of it as a lightweight, terminal-first companion for your API development workflow, similar in spirit to tools like Postman or Insomnia, but living entirely in your console.
- Interactive Request Building: Guided prompts for every step.
- Multiple Body Types: JSON, Form Data, Raw Text, and File Uploads.
- Pretty Output: Colorized, formatted, and syntax-highlighted responses.
- Request History: Quickly re-run past requests.
- Saved Requests: Store and load complex request configurations.
- Environment Variables: Use placeholders like
{{base_url}}for dynamic values. - Bearer Token Helper: Easy
Authorization: Bearer <token>header management. - Save Response to File: Download API responses.
- Cross-Platform: Works on Linux, macOS, and Windows.
-
Prerequisites:
- Python 3.8+
pip(Python package installer)
-
Clone the Repository:
git clone https://github.com/samunderSingh12/cutieAPI.git cd cutieAPI -
Install Dependencies: cutieAPI relies on
requestsandrich.pip install requests rich
(Recommended: Use a virtual environment)
python -m venv venv source venv/bin/activate # On Windows: venv\Scripts\activate pip install requests rich
-
Run cutieAPI: Navigate to the directory containing
main.pyand run:python main.py
You'll be greeted with the main menu:
โญโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโฎ โ ๐ cutieAPI vX.X.X ๐ - Enhanced Edition โ โฐโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโฏ โโโโโโโโโโโโโโโโโโโโโโโโโ Configure New Request โโโโโโโโโโโโโโโโโโโโโโโโโโ Start with? [new/history/load/env/quit] (new): -
Initial Action - Choose Your Starting Point:
new(Default): Start building a request from scratch.history: View past requests.Request History โโโโโณโโโโโโโโโโโโโณโโโโโโโโโณโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ โ # โ Timestamp โ Method โ URL โ โกโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโฉ โ 1 โ 2023-10-27 โ POST โ http://localhost:8000/items/ โ โ 2 โ 2023-10-27 โ GET โ http://localhost:8000/ping โ โโ Rerun Request โโโโโโโโโโโโโโโโ Enter # to re-run (0 to cancel) (0): 1load: Load a previously saved request configuration.Saved Requests โโโโโณโโโโโโโโโโโโโโโโโโโโโโ โ # โ Request Name โ โกโโโโโโโโโโโโโโโโโโโโโโโโโโฉ โ 1 โ create_new_user โ โ 2 โ get_all_products โ โโ Load Request โโโโโโโโโโโโโโโโ Enter # to load (0 to cancel) (0): 1env: Manage environment variables. You can add, remove, or list variables like{{base_url}}or{{auth_token}}.Action? [add/remove/list/done] (done): add Variable name (e.g., base_url): api_key Value for api_key: your_secret_api_key_herequit: Exit cutieAPI.
-
Define the Request Method & URL:
Enter HTTP method [GET/POST/PUT/DELETE/PATCH/HEAD/OPTIONS] (GET): POST Enter the full API URL (e.g., {{base_url}}/items): {{base_url}}/items(cutieAPI will substitute
{{base_url}}if you've defined it inenv) -
Add Query Parameters (Optional):
Manage query parameters? (y/N) [False]: y Current query parameters: None Enter query parameters one by one (e.g., limit=10)... Empty line to finish. Query Param (key=value, or empty to finish): page=1 Query Param (key=value, or empty to finish): limit=20 Query Param (key=value, or empty to finish): -
Manage Headers (Optional):
Manage custom headers? (y/N) [False]: y Current headers: None Enter headers one by one... Empty line to finish. Header (or leave empty to finish): Content-Type: application/json Header (or leave empty to finish): X-Custom-Header: MyValue Header (or leave empty to finish):- Bearer Token Helper:
Add/Update Bearer Token Authorization? (y/N) [False]: y Enter Bearer Token: your_jwt_token_here
- Bearer Token Helper:
-
Specify Request Body (for
POST,PUT,PATCH): You'll be prompted for theRequest body type?.json:Request body type? [json/form/file/raw/none] (json): json Enter JSON body. Ctrl+D (Unix) or Ctrl+Z+Enter (Windows) to finish. { "name": "cutieAPI Test", "value": 123, "tags": ["test", "{{env_tag}}"] } <Ctrl+D>form(application/x-www-form-urlencoded):Request body type? [json/form/file/raw/none] (json): form Enter form data (key=value, one per line)... Empty line to finish. Form data (key=value, or empty to finish): username=cutie Form data (key=value, or empty to finish): type=api Form data (key=value, or empty to finish):file(multipart/form-data):Request body type? [json/form/file/raw/none] (json): file Enter text fields for multipart form (key=value)... Empty line to finish. Text field (key=value, or empty to finish): description=Test upload Text field (key=value, or empty to finish): Add files for multipart form. Add/Update a file? (Y/n) [True]: y Form field name for the file (e.g., 'upload_file'): myFile Path to the file: /path/to/your/document.pdfraw:Request body type? [json/form/file/raw/none] (json): raw Enter raw text body. Ctrl+D (Unix) or Ctrl+Z+Enter (Windows) to finish. <xml><message>Hello from cutieAPI!</message></xml> <Ctrl+D>none: No request body will be sent.
-
Review Sent Request & View Response: cutieAPI will display a summary of what's being sent, then the server's response:
โโโโโโโโโโโโโโโโโโ Sending POST request to http://localhost:8000/items โโโโโโโโโโโโโโโโโโโ Query Params: {'page': '1', 'limit': '20'} Headers Sent: Content-Type: application/json X-Custom-Header: MyValue JSON Body Sent: โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ โ 1 { โ โ 2 "name": "cutieAPI Test", โ โ 3 "value": 123, โ โ 4 "tags": [ โ โ 5 "test", โ โ 6 "beta" โ โ 7 ] โ โ 8 } โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโโโโโโโโโโ Response Received (15.32 ms) โโโโโโโโโโโโโโโโโโโโโโโโโ Status Code: 201 Created Response Headers: โโโโโโโโโโโโโโโโโโโโโโณโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ โ date โ Fri, 27 Oct 2023 10:00:00 GMT โ โ server โ uvicorn โ โ content-type โ application/json โ โโโโโโโโโโโโโโโโโโโโโโปโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ Response Body: โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ โ 1 { โ โ 2 "id": 101, โ โ 3 "name": "cutieAPI Test", โ โ 4 "value": 123, โ โ 5 "tags": [ โ โ 6 "test", โ โ 7 "beta" โ โ 8 ], โ โ 9 "message": "Item created successfully" โ โ10 } โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ -
Post-Request Actions:
- Save Response Body?: Prompts you to save the response content to a local file.
- Save this request configuration?: Allows you to save the entire request setup (URL, headers, body, etc.) for quick loading later.
- Make another request?: Choose to continue or exit cutieAPI.
- History:
~/.api_buddy_history.json(stores last 50 requests).- Note: The filename still uses
api_buddy. You might want to update this in the code (HISTORY_FILEvariable) to~/.cutieapi_history.jsonfor consistency if you haven't already.
- Note: The filename still uses
- Saved Requests:
~/.api_buddy_saved_requests/- Note: Similarly, consider renaming this directory in code (
SAVED_REQUESTS_DIRvariable) to~/.cutieapi_saved_requests/.
- Note: Similarly, consider renaming this directory in code (
Contributions are welcome! Whether it's bug fixes, new features, or documentation improvements, please feel free to:
- Fork the repository.
- Create a new branch for your feature or fix (
git checkout -b feature/your-feature-name). - Make your changes and test them thoroughly.
- Commit your changes (
git commit -am 'Add some feature'). - Push to the branch (
git push origin feature/your-feature-name). - Create a new Pull Request.
If you encounter any bugs or have feature suggestions, please open an issue on GitHub.
This project is open-source and available under the MIT License
Happy API Bashing with cutieAPI! ๐
