Skip to content

Commit

Permalink
feat(docs): add HTTP API docs
Browse files Browse the repository at this point in the history
  • Loading branch information
h2non committed May 27, 2016
1 parent 103c9b4 commit c412a8e
Showing 1 changed file with 242 additions and 10 deletions.
252 changes: 242 additions & 10 deletions docs/Admin_HTTP_API.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ The RESTful Admin API server listens on port 8000 by default.

RESTful Admin API is part of [manager](https://github.com/vinxi/vinxi/tree/master/manager) package. Read more about the manager [here](#manager).

### Content Types
## Content Types

vinxi RESTful API is a JSON only HTTP interface.
Responses and payloads as designed to render and read JSON only data structures.
Expand All @@ -15,33 +15,33 @@ The MIME content type used as HTTP `Content-Type` header must be:
application/json
```

### Authentication
## Authentication

You can protect the admin HTTP API with a basic authentication mechanism.

Admin HTTP API is not protected by default.

#### HTTP basic authentication
### HTTP basic authentication

You can define multiple user/password credentials to authenticate users.

### Endpoints
## Endpoints

#### Node information
### Node information

##### Endpoint

| **GET** | / |
```
GET /
```

##### Response
#### Response

```
HTTP 200 OK
```

```json
{
"hostname": "tomas-laptop",
"hostname": "vinxi-server",
"version": "0.1.0",
"runtime": "go1.6",
"platform": "darwin",
Expand All @@ -57,7 +57,239 @@ HTTP 200 OK
}
```

### Global plugins

#### List plugins

```
GET /plugins
```

##### Response

```json
[
{
"id": "UGEZGfua5S3U0nDS",
"name": "auth",
"description": "Authorization and authentication protection",
"config": {
"scheme": "Bearer",
"token": "s3cr3t"
}
}
]
```

#### List plugins

```
GET /plugins
```

##### Response

```json
[
{
"id": "UGEZGfua5S3U0nDS",
"name": "auth",
"description": "Authorization and authentication protection",
"config": {
"scheme": "Bearer",
"token": "s3cr3t"
}
}
]
```

#### Register plugin

```
GET /plugins/{id}
```

##### Request Body

```json
{
"name":"auth",
"config": {
"token": "s3cr3t"
}
}
```

##### Response

```json
{
"id": "UGEZGfua5S3U0nDS",
"name": "auth",
"description": "Authorization and authentication protection",
"config": {
"scheme": "Bearer",
"token": "s3cr3t"
}
}
```

#### Get plugin

```
GET /plugins/{id}
```

##### Response

```json
{
"id": "UGEZGfua5S3U0nDS",
"name": "auth",
"description": "Authorization and authentication protection",
"config": {
"scheme": "Bearer",
"token": "s3cr3t"
}
}
```

#### Delete plugin

```
DELETE /plugins/{id}
```

#### Response

```
HTTP 204 No Content
```

### Instances

#### List instances

```
GET /instances
```

#### Response

```
HTTP 200 OK
```

```json
[
{
"info": {
"id": "KamlJHrvH2owdzIG",
"name": "default",
"description": "This a default proxy",
"hostname": "vinxi-server",
"platform": "darwin",
"server": {
"port": 3100,
"readTimeout": 0,
"writeTimeout": 0,
"address": ""
}
},
"scopes": [
{
"id": "jd7CDZ48IsQ0RJqu",
"name": "custom",
"rules": [
{
"id": "MizprxflGgjeQe06",
"name": "path",
"description": "Matches HTTP request URL path againts a given path pattern",
"config": {
"path": "\/foo\/(.*)"
}
}
],
"plugins": [
{
"id": "AsgTHxwUgUcg9oet",
"name": "forward",
"description": "Forward HTTP traffic to remote servers",
"config": {
"url": "http:\/\/httpbin.org"
}
}
]
}
]
}
]
```

#### Get instance

```
GET /instances/{id}
```

#### Response

```
HTTP 200 OK
```

```json
{
"info": {
"id": "KamlJHrvH2owdzIG",
"name": "default",
"description": "This a default proxy",
"hostname": "test",
"platform": "darwin",
"server": {
"port": 3100,
"readTimeout": 0,
"writeTimeout": 0,
"address": ""
}
},
"scopes": [
{
"id": "jd7CDZ48IsQ0RJqu",
"name": "custom",
"rules": [
{
"id": "MizprxflGgjeQe06",
"name": "path",
"description": "Matches HTTP request URL path againts a given path pattern",
"config": {
"path": "\/foo\/(.*)"
}
}
],
"plugins": [
{
"id": "AsgTHxwUgUcg9oet",
"name": "forward",
"description": "Forward HTTP traffic to remote servers",
"config": {
"url": "http:\/\/httpbin.org"
}
}
]
}
]
}
```

#### Delete instance

```
DELETE /instances/{id}
```

#### Response

```
HTTP 204 No Content
```

0 comments on commit c412a8e

Please sign in to comment.