APIX is a modern HTTP client for the command line.
π¨ 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 to pretty print requests and responses
> apix get https://apix.io/json
{
"id": 0,
"test": "hello"
}
- Beatifull as it uses Indicatif to show modern command line progress bars when uploading or downloading files
> 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 for interactive prompt to guide you when creating requests or executing them
> 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 template engine to allow your requests to do complex things if you want them to (see examples)
- Easy to use in the command line as it uses 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 git
Coming 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
apix 0.3.0
USAGE:
apix [OPTIONS] <SUBCOMMAND>
OPTIONS:
-h, --help Print help information
-v, --verbose print full request and response
-V, --version Print version information
SUBCOMMANDS:
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
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.
> 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 :
> 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/json
HTTP/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
}
]
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
apix ctl init MyContext
apix ctl switch OtherContext
apix ctl get contexts
apix ctl delete MyContext
apix-get
get an http resource
USAGE:
apix get [OPTIONS] <url>
ARGS:
<url> url to request, can be a 'Tera' template
OPTIONS:
-b, --body <body> set body to send with request, can be a 'Tera' template
-c, --cookie <cookie> set cookie name:value to send with request
-e, --env <variable> set variable name:value for 'Tera' template rendering
-f, --file <file> set body from file to send with request, can be a 'Tera' template
-h, --help Print help information
-H, --header <header> set header name:value to send with request
-i, --insecure allow insecure connections when using https
-q, --query <query> set query name:value to send with request
-v, --verbose print full request and response
Apix 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 :
-x, --proxy <url> set proxy to use for request
--proxy-login <login> set proxy login to use for request
--proxy-password <password> set proxy password to use for request
Here are the options available for configuting the proxy on manifests
metadata:
annotations:
apix.io/proxy-url: <url>
apix.io/proxy-login: <login>
apix.io/proxy-password: <paswword>
example URL for proxies:
HTTP | HTTPS | SOCKS5 |
---|---|---|
http://localhost:3128 | https://localhost:3128 | socks5://localhost:1080 |
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 |