Adding snowboard Blueprint API tool

This commit is contained in:
Filip Bucek 2019-09-30 17:23:11 +02:00
parent 1bb07f0227
commit fdc6ec96d7
4 changed files with 117 additions and 6 deletions

View File

@ -32,3 +32,15 @@ curl -k --user "spaceti:E7FEA07DBC82FB9BA34B2E453E2EFE89F0583E7187543507EF11E847
```bash
curl -k --user "spaceti:E7FEA07DBC82FB9BA34B2E453E2EFE89F0583E7187543507EF11E84726071FE428445372F2E46B455EB0C79747C51E362F403CE39473A2A8C2DFA0CE5C9826C0" -d '{"password":"E7FEA07DBC82FB9BA34B2E453E2EFE89F0583E7187543507EF11E84726071FE428445372F2E46B455EB0C79747C51E362F403CE39473A2A8C2DFA0CE5C9826C0","username":"spaceti"}' -H "Content-Type: application/json" https://192.168.254.11:8443/AaaManager/authSession
```
## Testing Blueprint API
### Snowboard
`snowboard http -c snowboard.yml --playground colnod.apib`
[Colnod API snowboard documentation](http://localhost:8088)
#### Install snowboard
`npm install -g snowboard`

63
colnod.apib Normal file
View File

@ -0,0 +1,63 @@
FORMAT: 1A
# JSON Schema
Every request and response can have a schema. Below you will find examples
using [JSON Schema](http://json-schema.org/) to describe the format of request
and response body content.
# Notes [/AaaManager/authSession]
+ Body
+ username: spaceti (required) - User identifier
+ password: E7FEA07DBC82FB9BA34B2E453E2EFE89F0583E7187543507EF11E84726071FE428445372F2E46B455EB0C79747C51E362F403CE39473A2A8C2DFA0CE5C9826C0 (required) - sha512 password
## Get a note [POST]
Gets a single note by its unique identifier.
+ Request (application/json)
+ Body
{
"user": "String",
"password": "String ",
}
+ Schema
{
"type": "object",
"properties": {
"username": {
"type": "string"
},
"password": {
"type": "string"
},
}
}
+ Response 200 (application/json)
+ Body
{
"id": "String",
"token": "String ",
}
+ Schema
{
"type": "object",
"properties": {
"id": {
"type": "string"
},
"token": {
"type": "string"
},
}
}

View File

@ -12,7 +12,7 @@ Jira issues:
email: filip.bucek@spaceti.com
servers:
- url: http://192.168.1.3:8443
- url: https://192.168.1.3:8443
tags:
- name: login
@ -26,6 +26,8 @@ paths:
post:
summary: Login user
description: Loging using sha512 hash
security:
- basicAuth: [spaceti]
requestBody:
description: Optional description in *Markdown*
required: true
@ -46,13 +48,13 @@ paths:
"200":
description: Login success
content:
"*/*":
application/json:
schema:
$ref: "#/components/schemas/Token"
"400":
description: ""
content:
"*/*":
application/json:
schema:
$ref: "#/components/schemas/Token"
/SubjectManager/getSubjects:
@ -102,16 +104,20 @@ components:
properties:
username:
type: string
example: spaceti
password:
type: string
example: E7FEA07DBC82FB9BA34B2E453E2EFE89F0583E7187543507EF11E84726071FE428445372F2E46B455EB0C79747C51E362F403CE39473A2A8C2DFA0CE5C9826C0
Token:
type: object
properties:
tokenType:
id:
type: string
tokenBits:
type: integer
example: spaceti
token:
type: string
example: E7FEA07DBC82FB9BA34B2E453E2EFE89F0583E7187543507EF11E84726071FE428445372F2E46B455EB0C79747C51E362F403CE39473A2A8C2DFA0CE5C9826C0
# security:
# - basicAuth: [d] # <-- use the same name here

30
snowboard.yml Normal file
View File

@ -0,0 +1,30 @@
html:
playground:
enabled: true
env: development
environments:
development:
url: https://192.168.1.3:8443
auth:
name: basic
options:
username: spaceti
password: E7FEA07DBC82FB9BA34B2E453E2EFE89F0583E7187543507EF11E84726071FE428445372F2E46B455EB0C79747C51E362F403CE39473A2A8C2DFA0CE5C9826C0
staging:
url: https://staging.example.com/
auth:
name: basic
options:
username: admin
password: secret
production:
url: https://api.example.com
auth:
name: oauth2
options:
authorizeUrl: https://accounts.example.com/oauth/authorize
tokenUrl: https://accounts.example.com/oauth/access_token
callbackUrl: https://www.example.com
clientId: <client-id>
clientSecret: <client-secret>
scopes: <scope-names>