All Downloads are FREE. Search and download functionalities are using the official Maven repository.

bash.README.mustache Maven / Gradle / Ivy

There is a newer version: 7.7.0
Show newest version
# {{appName}} Bash client

## Overview

This is a Bash client script for accessing {{appName}} service.

The script uses cURL underneath for making all REST calls.

## Usage

```shell
# Make sure the script has executable rights
$ chmod u+x {{scriptName}}

# Print the list of operations available on the service
$ ./{{scriptName}} -h

# Print the service description
$ ./{{scriptName}} --about

# Print detailed information about specific operation
$ ./{{scriptName}}  -h

# Make GET request
./{{scriptName}} --host http://: --accept xml  = :

# Make GET request using arbitrary curl options (must be passed before ) to an SSL service using username:password
{{scriptName}} -k -sS --tlsv1.2 --host https:// -u : --accept xml  = :

# Make POST request
$ echo '' | {{scriptName}} --host  --content-type json  -

# Make POST request with simple JSON content, e.g.:
# {
#   "key1": "value1",
#   "key2": "value2",
#   "key3": 23
# }
$ echo '' | {{scriptName}} --host  --content-type json  key1==value1 key2=value2 key3:=23 -

# Make POST request with form data
$ {{scriptName}} --host   key1:=value1 key2:=value2 key3:=23

# Preview the cURL command without actually executing it
$ {{scriptName}} --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 {{scriptName}}.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 {{scriptName}}.bash-completion /etc/bash-completion.d/{{scriptName}}
```

#### 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 `_{{scriptName}}` Zsh completion file must be copied to one of the folders under `$FPATH` variable.

## Documentation for API Endpoints

All URIs are relative to *{{basePathWithoutHost}}*

Class | Method | HTTP request | Description
------------ | ------------- | ------------- | -------------
{{#apiInfo}}{{#apis}}{{#operations}}{{#operation}}*{{classname}}* | [**{{operationId}}**]({{apiDocPath}}{{classname}}.md#{{operationIdLowerCase}}) | **{{httpMethod}}** {{path}} | {{summary}}
{{/operation}}{{/operations}}{{/apis}}{{/apiInfo}}

## Documentation For Models

{{#models}}{{#model}} - [{{{classname}}}]({{modelDocPath}}{{{classname}}}.md)
{{/model}}{{/models}}

## Documentation For Authorization

{{^authMethods}} All endpoints do not require authorization.
{{/authMethods}}{{#authMethods}}{{#last}} Authentication schemes defined for the API:{{/last}}{{/authMethods}}
{{#authMethods}}## {{{name}}}

{{#isApiKey}}

- **Type**: API key
- **API key parameter name**: {{{keyParamName}}}
- **Location**: {{#isKeyInQuery}}URL query string{{/isKeyInQuery}}{{#isKeyInHeader}}HTTP header{{/isKeyInHeader}}
{{/isApiKey}}
{{#isBasicBasic}}

- **Type**: HTTP basic authentication
{{/isBasicBasic}}
{{#isBasicBearer}}

- **Type**: HTTP Bearer Token authentication{{#bearerFormat}} ({{{.}}}){{/bearerFormat}}
{{/isBasicBearer}}
{{#isHttpSignature}}

- **Type**: HTTP signature authentication
{{/isHttpSignature}}
{{#isOAuth}}

- **Type**: OAuth
- **Flow**: {{{flow}}}{{#authorizationUrl}}
- **Authorization URL**: {{{.}}}{{/authorizationUrl}}{{#tokenUrl}}
- **Token URL**: {{{.}}}{{/tokenUrl}}
- **Scopes**:{{^scopes}} N/A{{/scopes}}
{{#scopes}}  - **{{{scope}}}**: {{{description}}}
{{/scopes}}
{{/isOAuth}}

{{/authMethods}}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy