Update 'com.noccy.apiclient'

Chris 2021-12-11 01:07:06 +00:00
parent 53ee6d74b3
commit 0a053f08a4

@ -1 +1,73 @@
# ApiClient Plugin
# ApiClient Plugin
## Creating catalogs and requests
```
$ spark api:catalog --create myapp baseurl=http://127.0.0.1/app/ info="MyApp API"
$ spark api:request --save myapp.ping url=v2/ping info="Ping the server" http.header.X-Special=magic
```
Requests are performed with the `api:request` command:
```
$ spark api:request myapp.ping
```
## Internals
ApiClient works on a map of properties, populated with the defaults from the
catalog. The request properties are then appied, followed by the profile
properties.
### Properties
```
## Core properties
# What protocol to use
protocol={"http"|"websocket"|"xmlrpc"|"jsonrpc"}
# Final URL is [urlbase+]url
urlbase={url}
url={url}
## Authentication options
# Username and password, for basic authentication
auth.username={username}
auth.password={password}
# Token, for bearer authentication
auth.token={token}
# If there is ever a need to be explicit
auth.type={"auto"|"basic"|"bearer"}
## HTTP options
# HTTP request method
http.method={"GET"|"POST"|...}
# HTTP request version
http.version={"1.0"|"1.1"|"2.0"}
# HTTP request header
http.header.{name}={value}
# HTTP query string field
http.query.{field}={value}
# HTTP POST body
http.body={raw-body}
# HTTP POST body as json or object
http.body.json={object}
## RPC options
# The method to invoke for XmlRpc and JsonRpc
rpc.method={string}
# Set argument by index or name
rpc.argument.{index}={value}
## Request handling
# Follow HTTP redirects?
request.follow-redirects={"auto"|"no"|"yes"}
# Max number of redirects to follw
request.max-redirects={number}
## Response handling
# Parse the response, for readability
response.parse={"none"|"json"|"yaml"|"xml"}
# Response codes that are considered good
response.good="200,201,202,203,204,205,206,207,208"
```