https://github.com/brooswit/openapitest
https://github.com/brooswit/openapitest
Last synced: about 1 year ago
JSON representation
- Host: GitHub
- URL: https://github.com/brooswit/openapitest
- Owner: brooswit
- Created: 2017-09-08T20:45:43.000Z (almost 9 years ago)
- Default Branch: master
- Last Pushed: 2017-09-08T21:03:48.000Z (almost 9 years ago)
- Last Synced: 2025-02-22T16:02:44.382Z (over 1 year ago)
- Language: Shell
- Size: 35.2 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# LaunchDarkly REST API Bash client
## Overview
This is a Bash client script for accessing LaunchDarkly REST API service.
The script uses cURL underneath for making all REST calls.
## Usage
```shell
# Make sure the script has executable rights
$ chmod u+x
# Print the list of operations available on the service
$ ./ -h
# Print the service description
$ ./ --about
# Print detailed information about specific operation
$ ./ -h
# Make GET request
./ --host http://: --accept xml = :
# Make GET request using arbitrary curl options (must be passed before ) to an SSL service using username:password
-k -sS --tlsv1.2 --host https:// -u : --accept xml = :
# Make POST request
$ echo '' | --host --content-type json -
# Make POST request with simple JSON content, e.g.:
# {
# "key1": "value1",
# "key2": "value2",
# "key3": 23
# }
$ echo '' | --host --content-type json key1==value1 key2=value2 key3:=23 -
# Preview the cURL command without actually executing it
$ --host http://: --dry-run
```
## Docker image
You can easily create a Docker image containing a preconfigured environment
for using the REST Bash client including working autocompletion and short
welcome message with basic instructions, using the generated Dockerfile:
```shell
docker build -t my-rest-client .
docker run -it my-rest-client
```
By default you will be logged into a Zsh environment which has much more
advanced auto completion, but you can switch to Bash, where basic autocompletion
is also available.
## Shell completion
### Bash
The generated bash-completion script can be either directly loaded to the current Bash session using:
```shell
source .bash-completion
```
Alternatively, the script can be copied to the `/etc/bash-completion.d` (or on OSX with Homebrew to `/usr/local/etc/bash-completion.d`):
```shell
sudo cp .bash-completion /etc/bash-completion.d/
```
#### OS X
On OSX you might need to install bash-completion using Homebrew:
```shell
brew install bash-completion
```
and add the following to the `~/.bashrc`:
```shell
if [ -f $(brew --prefix)/etc/bash_completion ]; then
. $(brew --prefix)/etc/bash_completion
fi
```
### Zsh
In Zsh, the generated `_` Zsh completion file must be copied to one of the folders under `$FPATH` variable.