Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/ecyrbe/apix-rust
Apix is a modern HTTP client for the command line.
https://github.com/ecyrbe/apix-rust
api curl http http-client httpie postman rest rest-api wget
Last synced: 3 months ago
JSON representation
Apix is a modern HTTP client for the command line.
- Host: GitHub
- URL: https://github.com/ecyrbe/apix-rust
- Owner: ecyrbe
- License: mit
- Created: 2021-10-22T18:04:17.000Z (over 3 years ago)
- Default Branch: main
- Last Pushed: 2022-01-23T13:57:27.000Z (almost 3 years ago)
- Last Synced: 2024-10-04T15:47:32.709Z (4 months ago)
- Topics: api, curl, http, http-client, httpie, postman, rest, rest-api, wget
- Language: Rust
- Homepage:
- Size: 336 KB
- Stars: 15
- Watchers: 2
- Forks: 1
- Open Issues: 5
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- Funding: .github/FUNDING.yml
- License: LICENSE
- Code of conduct: CODE_OF_CONDUCT.md
Awesome Lists containing this project
README
APIX is a modern HTTP client for the command line.```yaml
๐จ WARNING: ๐ง Apix is still in alpha/proof of concept state! ๐ง
```Apix brings ideas from tools like `Git`,`Kubernetes`, `Helm` ,`Httpie`.
Indeed it's is not just a simple HTTP client, Apix is :
- **Pretty** as it uses [Bat](https://github.com/sharkdp/bat) to pretty print requests and responses
```bash
> apix get https://apix.io/json
{
"id": 0,
"test": "hello"
}
```
- **Beatifull** as it uses [Indicatif](https://docs.rs/indicatif/latest/indicatif/index.html) to show modern command line progress bars when uploading or downloading files
```bash
> apix get https://apix.io/test.mp4
Downloading File test.mp4
๐ [00:00:28] [โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ] 14.98MiB/298.06MiB (549.87KiB/s, 8m)
```
- **Friendly** to use as it uses [Dialoguer](https://docs.rs/dialoguer/latest/dialoguer/index.html) for interactive prompt to guide you when creating requests or executing them
```bash
> apix exec -f request.yaml
โ todoId ยท 1
? email ("[email protected]") โบ bad\gmail.com
โ Invalid input:
cause 0: "bad\gmail.com" is not a "email"
```
- **Powerfull** as it uses [Tera](https://tera.netlify.app/) template engine to allow your requests to do complex things if you want them to (see [examples](/examples))
- **Easy** to use in the command line as it uses [Clap](https://docs.rs/clap/latest/clap/) autocompletion
- **Reusable** as it stores your requests in your file system in a readable format for later use (yaml)
- **Helping you not forget** as it stores the response of the requests so you can consult them at any time
- **Helping you test APIs** as it allows you to create request stories (chain requests, use results of a request to make another one)
- **Team player** as it allows you to naturally share your request collections with gitComing soon:
- **Secure** as it handles secrets stored in hashi corp vault
- **Enterprise friend** as it allows you to import OpenAPI definition files into apix requests files## help
```bash
apix 0.3.0USAGE:
apix [OPTIONS]OPTIONS:
-h, --help Print help information
-v, --verbose print full request and response
-V, --version Print version informationSUBCOMMANDS:
completions generate shell completions
config configuration settings
ctl apix control interface for handling multiple APIs
delete delete an http resource
exec execute a request from the current API context
get get an http resource
head get an http resource header
help Print this message or the help of the given subcommand(s)
history show history of requests sent (require project)
init initialise a new API context in the current directory by using git
patch patch an http resource
post post to an http resource
put put to an http resource
```## make simple http requests
Even if Apix allows you to use advanced mode by coupling it to a git repository and interpret openapi declarations (swagger), you also can use Apix as a replacement for curl, wget, httpie ...
Apix will colorize the output according to http **content-type** header information.
By default Apix will assume you are doing an API request using json.```bash
> apix get https://jsonplaceholder.typicode.com/todos?_limit=1
or
> apix get https://jsonplaceholder.typicode.com/todos --query _limit:1[
{
"userId": 1,
"id": 1,
"title": "delectus aut autem",
"completed": false
}
]
```
you can also ask for verbose mode where apix will show you the full sended http request and response :
```bash
> apix get -v https://jsonplaceholder.typicode.com/todos -q_limit:1
GET /todos?_limit=3 HTTP/1.1
host: jsonplaceholder.typicode.com
user-agent: apix/0.1.0
accept: application/json
accept-encoding: gzip
content-type: application/jsonHTTP/1.1 200 OK
date: Sun, 21 Nov 2021 17:29:22 GMT
content-type: application/json; charset=utf-8
transfer-encoding: chunked
connection: keep-alive
access-control-allow-credentials: true
cache-control: max-age=43200
pragma: no-cache
expires: -1
etag: W/"136-fTr038fftlG9yIOWHGimupdrQDg"[
{
"userId": 1,
"id": 1,
"title": "delectus aut autem",
"completed": false
}
]
```## Context
Apix handle contexts gracefully. Contexts are named resources to handle:
- API bindings (based on openAPI)
- Session authentification
- Session cookies
- variables bindings that can be used with templates### Create a new context
```bash
apix ctl init MyContext
```### Switching to another context
```bash
apix ctl switch OtherContext
```### List all contexts
```bash
apix ctl get contexts
```### Delete a context
```bash
apix ctl delete MyContext
```## apix commands
### apix get
```bash
apix-getget an http resource
USAGE:
apix get [OPTIONS]ARGS:
url to request, can be a 'Tera' templateOPTIONS:
-b, --body set body to send with request, can be a 'Tera' template
-c, --cookie set cookie name:value to send with request
-e, --env set variable name:value for 'Tera' template rendering
-f, --file set body from file to send with request, can be a 'Tera' template
-h, --help Print help information
-H, --header set header name:value to send with request
-i, --insecure allow insecure connections when using https
-q, --query set query name:value to send with request
-v, --verbose print full request and response
```
## ProxyApix uses system proxy by default. System proxy is taken from `HTTP_PROXY` and `HTTPS_PROXY` environment variables.
You can ovverride system proxy manually, either with request annotations on manifest files or on the command line.
Apix support `HTTP`, `HTTPS` and `SOCKS5` proxies.Here are the options available for configuring the proxy on the command line :
```bash
-x, --proxy set proxy to use for request
--proxy-login set proxy login to use for request
--proxy-password set proxy password to use for request
```
Here are the options available for configuting the proxy on manifests
```yaml
metadata:
annotations:
apix.io/proxy-url:
apix.io/proxy-login:
apix.io/proxy-password:
```
_example URL for proxies_:
| HTTP | HTTPS | SOCKS5 |
| --------------------- | ---------------------- | ----------------------- |
| http://localhost:3128 | https://localhost:3128 | socks5://localhost:1080 |# Persistance
| type | persist mode | gitignore | description |
| :------: | :----------: | :-------: | :-------------------------------------: |
| config | file | no | from cli config |
| requests | file | no |
| params | file | yes | auto saved from dialoguer |
| results | file | yes | auto saved after execution |
| cookies | file | yes | auto saved after execution, auto reused |
| storage | file | yes | saved from request response |
| secrets | web | N/A | from hashi corp vault |