# API Buddy
[![Build Status](https://circleci.com/gh/fonsecapeter/api-buddy.svg?style=svg)](https://circleci.com/gh/fonsecapeter/api-buddy)
[![PyPI version](https://badge.fury.io/py/api-buddy.svg)](https://badge.fury.io/py/api-buddy)
<img src="https://raw.githubusercontent.com/fonsecapeter/api-buddy/main/media/demo.gif" alt="demo">
> Right now, only OAuth2 authentication is supported. Happy to support more if anyone is interested, just up a ticket. 🎟
>
> You can also always manually set headers.
## Installation
As long as you have python 3.13 or higher (I recommend using [pyenv](https://github.com/pyenv/pyenv)), just:
```bash
pip install api-buddy
```
## Usage
First, specify the API you're exploring
```bash
api use https://some.api.com
```
Which will set the `api_url` value in your preferences file
```yaml
# ~/.api-buddy.yaml
api_url: https://some.api.com
```
Then it's as easy as:
```bash
api get some-endpoint
```
```json
=> 200
{
"look": "I haz data",
"thx": "API Buddy"
}
```
You can add query params in key=val format:
```bash
api get \
my/favorite/endpoint \
first_name=cosmo \
last_name=kramer
```
You can also add request body data in JSON format:
```bash
api post \
some-endpoint \
'{"id": 1, "field": "value"}'
```
🤔 Note the single-quotes, which keeps your json as a sing continuous string.
This means you can expand across multiple lines too:
```bash
api post \
some-endpoint \
'{
"id": 1,
"field": "value"
}'
```
### [Preferences 👉](https://github.com/fonsecapeter/api-buddy/blob/master/docs/preferences.md)
### Arguments
- `use`: (optional) Set the base `api_url` you're exploring in your preferences file.
- It come with the actual `api_url` value
If you're actually sending an HTTP request:
- `http_method`: (optional) The HTTP method to use in your request.
- It should be one of:
- `get`
- `post`
- `patch`
- `put`
- `delete`
- `endpoint`: (required) The relative path to an API endpoint.
- AKA you don't need to type the base api url again here.
- `params`: (optional) A list of `key=val` query params
- `data`: (optional) A JSON string of requets body data.
- You can't use this with `get` because HTTP.
### Options
- `-h`, `--help`: Show the help message
- `-v`, `--version`: Show the installed version
## Development
Requires:
- [poetry](https://poetry.eustace.io/)
- Python 3.13
- Suggest using: [pyenv](https://github.com/pyenv/pyenv)
Steps to start working:
- Build and create the local venv with `bin/setup`
- Make sure everything works with `bin/test`
- Try the local cli with `poetry run api --help`
- Find other management commands with `bin/list`
Note to self, publish flow is:
- `bin/bump`
- `git commit -m 'Major/Minor/Patch bump x.x.x -> y.y.y'`
- `bin/publish`
- `bin/tag`
Raw data
{
"_id": null,
"home_page": "https://github.com/fonsecapeter/api-buddy",
"name": "api-buddy",
"maintainer": null,
"docs_url": null,
"requires_python": "~=3.13.1",
"maintainer_email": null,
"keywords": "api_buddy, api-buddy, api, apibuddy, cli, oauth2, terminal",
"author": "Peter Fonseca",
"author_email": "peter.nfonseca@gmail.com",
"download_url": "https://files.pythonhosted.org/packages/c4/0d/8daefd022efb6f430fb77acb358f5c464032624ee2ba6b97a8d59e875d0c/api_buddy-0.7.0.tar.gz",
"platform": null,
"description": "# API Buddy\n[![Build Status](https://circleci.com/gh/fonsecapeter/api-buddy.svg?style=svg)](https://circleci.com/gh/fonsecapeter/api-buddy)\n[![PyPI version](https://badge.fury.io/py/api-buddy.svg)](https://badge.fury.io/py/api-buddy)\n\n<img src=\"https://raw.githubusercontent.com/fonsecapeter/api-buddy/main/media/demo.gif\" alt=\"demo\">\n\n> Right now, only OAuth2 authentication is supported. Happy to support more if anyone is interested, just up a ticket. \ud83c\udf9f\n>\n> You can also always manually set headers.\n\n## Installation\n\nAs long as you have python 3.13 or higher (I recommend using [pyenv](https://github.com/pyenv/pyenv)), just:\n```bash\npip install api-buddy\n```\n\n## Usage\n\nFirst, specify the API you're exploring\n```bash\napi use https://some.api.com\n```\n\nWhich will set the `api_url` value in your preferences file\n```yaml\n# ~/.api-buddy.yaml\napi_url: https://some.api.com\n```\n\nThen it's as easy as:\n```bash\napi get some-endpoint\n```\n```json\n=> 200\n{\n \"look\": \"I haz data\",\n \"thx\": \"API Buddy\"\n}\n```\n\nYou can add query params in key=val format:\n```bash\napi get \\\n my/favorite/endpoint \\\n first_name=cosmo \\\n last_name=kramer\n```\n\nYou can also add request body data in JSON format:\n```bash\napi post \\\n some-endpoint \\\n '{\"id\": 1, \"field\": \"value\"}'\n```\n\n\ud83e\udd14 Note the single-quotes, which keeps your json as a sing continuous string.\nThis means you can expand across multiple lines too:\n```bash\napi post \\\n some-endpoint \\\n '{\n \"id\": 1,\n \"field\": \"value\"\n }'\n```\n\n### [Preferences \ud83d\udc49](https://github.com/fonsecapeter/api-buddy/blob/master/docs/preferences.md)\n\n### Arguments\n- `use`: (optional) Set the base `api_url` you're exploring in your preferences file.\n - It come with the actual `api_url` value\n\nIf you're actually sending an HTTP request:\n- `http_method`: (optional) The HTTP method to use in your request.\n - It should be one of:\n - `get`\n - `post`\n - `patch`\n - `put`\n - `delete`\n- `endpoint`: (required) The relative path to an API endpoint.\n - AKA you don't need to type the base api url again here.\n- `params`: (optional) A list of `key=val` query params\n- `data`: (optional) A JSON string of requets body data.\n - You can't use this with `get` because HTTP.\n\n\n### Options\n- `-h`, `--help`: Show the help message\n- `-v`, `--version`: Show the installed version\n\n## Development\nRequires:\n- [poetry](https://poetry.eustace.io/)\n- Python 3.13\n - Suggest using: [pyenv](https://github.com/pyenv/pyenv)\n\nSteps to start working:\n- Build and create the local venv with `bin/setup`\n- Make sure everything works with `bin/test`\n- Try the local cli with `poetry run api --help`\n- Find other management commands with `bin/list`\n\nNote to self, publish flow is:\n- `bin/bump`\n- `git commit -m 'Major/Minor/Patch bump x.x.x -> y.y.y'`\n- `bin/publish`\n- `bin/tag`\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "Explore APIs from your console with API Buddy",
"version": "0.7.0",
"project_urls": {
"Documentation": "https://poetry.eustace.io/docs",
"Homepage": "https://github.com/fonsecapeter/api-buddy",
"Repository": "https://github.com/fonsecapeter/api-buddy"
},
"split_keywords": [
"api_buddy",
" api-buddy",
" api",
" apibuddy",
" cli",
" oauth2",
" terminal"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "1cca187cdee204b0137fd2444143fdfe90aa6bfb766aba79410dba0a809cbb1c",
"md5": "17e41164eef108fca22be5d978adc932",
"sha256": "1b7b7bb8fcc01ace363443739688d3277387b523b74859636bb502bbdde4bff6"
},
"downloads": -1,
"filename": "api_buddy-0.7.0-py3-none-any.whl",
"has_sig": false,
"md5_digest": "17e41164eef108fca22be5d978adc932",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": "~=3.13.1",
"size": 24369,
"upload_time": "2025-01-12T17:08:48",
"upload_time_iso_8601": "2025-01-12T17:08:48.962457Z",
"url": "https://files.pythonhosted.org/packages/1c/ca/187cdee204b0137fd2444143fdfe90aa6bfb766aba79410dba0a809cbb1c/api_buddy-0.7.0-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "c40d8daefd022efb6f430fb77acb358f5c464032624ee2ba6b97a8d59e875d0c",
"md5": "9be87d49edcf8d0e38214ee6be9e55dc",
"sha256": "12af2a00f30519c4db69332742e4591064641f7e629c1ccc615ee05d8c420679"
},
"downloads": -1,
"filename": "api_buddy-0.7.0.tar.gz",
"has_sig": false,
"md5_digest": "9be87d49edcf8d0e38214ee6be9e55dc",
"packagetype": "sdist",
"python_version": "source",
"requires_python": "~=3.13.1",
"size": 17666,
"upload_time": "2025-01-12T17:08:51",
"upload_time_iso_8601": "2025-01-12T17:08:51.184844Z",
"url": "https://files.pythonhosted.org/packages/c4/0d/8daefd022efb6f430fb77acb358f5c464032624ee2ba6b97a8d59e875d0c/api_buddy-0.7.0.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2025-01-12 17:08:51",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "fonsecapeter",
"github_project": "api-buddy",
"travis_ci": false,
"coveralls": true,
"github_actions": false,
"circle": true,
"lcname": "api-buddy"
}