mirror of
https://gitlab.com/spaceti-app/integrations/acs/colnod-connector.git
synced 2026-07-12 20:30:41 +02:00
Merge branch '2-add-swagger-description-file-for-restapi' into 'master'
WIP: Resolve "Add swagger description file for RestAPI" Closes #2 See merge request spaceti-app/integrations/acs/colnod-connector!2
This commit is contained in:
commit
3ee7babfa2
55
README.md
55
README.md
@ -1,6 +1,55 @@
|
|||||||
# colnod-connector
|
# colnod-connector
|
||||||
|
|
||||||
|
|
||||||
## Colnod
|
|
||||||
|
|
||||||
Acces Management System of Colsys: [Product info](http://produkty.colsys.cz/colnod/)
|
Acces Management System of Colsys: [Product info](http://produkty.colsys.cz/colnod/)
|
||||||
|
|
||||||
|
## RestAPI definitions
|
||||||
|
|
||||||
|
- `openapi.yaml` ( editor `VSCode` with `Swagger Viewer` extension - ⌘+⇧+P `Preview Swagger` )
|
||||||
|
|
||||||
|
## Colnod Test server
|
||||||
|
|
||||||
|
[Colnod server: confluence](https://spaceti.atlassian.net/wiki/spaces/IN/pages/97320961/Colsys+-+Colnod)
|
||||||
|
|
||||||
|
- URL: `192.168.1.3:8843`
|
||||||
|
- `!!! No license!!!` - server will shutdown after 8 hours.
|
||||||
|
- restart: `sudo service cndserver start`
|
||||||
|
- check `nmap -p8443 192.168.1.3` or `nc -zvw3 192.168.1.3 8443`
|
||||||
|
- user: `spaceti`
|
||||||
|
- password: ``
|
||||||
|
- sha512: `E7FEA07DBC82FB9BA34B2E453E2EFE89F0583E7187543507EF11E84726071FE428445372F2E46B455EB0C79747C51E362F403CE39473A2A8C2DFA0CE5C9826C0`
|
||||||
|
|
||||||
|
```bash
|
||||||
|
curl -k --user "spaceti:E7FEA07DBC82FB9BA34B2E453E2EFE89F0583E7187543507EF11E84726071FE428445372F2E46B455EB0C79747C51E362F403CE39473A2A8C2DFA0CE5C9826C0" -d '{"password":"E7FEA07DBC82FB9BA34B2E453E2EFE89F0583E7187543507EF11E84726071FE428445372F2E46B455EB0C79747C51E362F403CE39473A2A8C2DFA0CE5C9826C0","username":"spaceti"}' -H "Content-Type: application/json" https://192.168.1.3:8443/AaaManager/authSession
|
||||||
|
```
|
||||||
|
|
||||||
|
## Colnod Penta server
|
||||||
|
|
||||||
|
- Acces through: `penta-master` IP:`172.16.3.4`
|
||||||
|
- URL: `192.168.254.11:8443`
|
||||||
|
- Port forwarding: `ssh -L 8443:192.168.254.11:8443 penta-master`
|
||||||
|
- `!!! does not work !!!`
|
||||||
|
|
||||||
|
```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
|
||||||
|
|
||||||
|
#### Necesarry to allow
|
||||||
|
|
||||||
|
- Self signed certificate: [Stack overflow](https://superuser.com/a/1235250)
|
||||||
|
- Enable CORS:
|
||||||
|
- Safari: Develop->Disable cross origin restrictions
|
||||||
|
|
||||||
|
`snowboard http -c snowboard.yml --playground colnod.apib`
|
||||||
|
|
||||||
|
[Colnod API snowboard documentation](http://localhost:8088)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#### Install snowboard
|
||||||
|
|
||||||
|
`npm install -g snowboard`
|
||||||
|
|||||||
53
colnod.apib
Normal file
53
colnod.apib
Normal file
@ -0,0 +1,53 @@
|
|||||||
|
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.
|
||||||
|
|
||||||
|
# Login manager [/AaaManager/authSession]
|
||||||
|
|
||||||
|
## Get login token [POST]
|
||||||
|
Gets a single note by its unique identifier.
|
||||||
|
|
||||||
|
+ Request (application/json)
|
||||||
|
|
||||||
|
+ Body
|
||||||
|
|
||||||
|
{
|
||||||
|
"password": "E7FEA07DBC82FB9BA34B2E453E2EFE89F0583E7187543507EF11E84726071FE428445372F2E46B455EB0C79747C51E362F403CE39473A2A8C2DFA0CE5C9826C0",
|
||||||
|
"username": "spaceti"
|
||||||
|
}
|
||||||
|
|
||||||
|
+ Schema
|
||||||
|
|
||||||
|
{
|
||||||
|
"type": "object",
|
||||||
|
"properties": {
|
||||||
|
"username": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"password": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
+ Response 200 (application/json)
|
||||||
|
|
||||||
|
+ Body
|
||||||
|
|
||||||
|
{
|
||||||
|
"id": "String",
|
||||||
|
}
|
||||||
|
|
||||||
|
+ Schema
|
||||||
|
|
||||||
|
{
|
||||||
|
"type": "object",
|
||||||
|
"properties": {
|
||||||
|
"id": {
|
||||||
|
"type": "string"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
123
openapi-testserver.yaml
Normal file
123
openapi-testserver.yaml
Normal file
@ -0,0 +1,123 @@
|
|||||||
|
openapi: 3.0.0
|
||||||
|
info:
|
||||||
|
description: "Colnod system: [Product information](http://produkty.colsys.cz/colnod)
|
||||||
|
Jira issues:
|
||||||
|
[Communicaiton with
|
||||||
|
Colnod](https://spaceti.atlassian.net/secure/RapidBoard.jspa?rapidView=78&p\
|
||||||
|
rojectKey=INT&modal=detail&selectedIssue=INT-3563)"
|
||||||
|
version: 1.0.0
|
||||||
|
title: Colnod server
|
||||||
|
contact:
|
||||||
|
name: Filip Bucek
|
||||||
|
email: filip.bucek@spaceti.com
|
||||||
|
|
||||||
|
servers:
|
||||||
|
- url: https://192.168.1.3:8443
|
||||||
|
|
||||||
|
tags:
|
||||||
|
- name: login
|
||||||
|
description: Login information ( token )
|
||||||
|
- name: user
|
||||||
|
description: Operations about user
|
||||||
|
- name: token
|
||||||
|
description: Working with tokens ( keys )
|
||||||
|
paths:
|
||||||
|
/AaaManager/authSession:
|
||||||
|
post:
|
||||||
|
summary: Login user
|
||||||
|
description: Loging using sha512 hash
|
||||||
|
security:
|
||||||
|
- basicAuth: [spaceti]
|
||||||
|
requestBody:
|
||||||
|
description: Optional description in *Markdown*
|
||||||
|
required: true
|
||||||
|
content:
|
||||||
|
application/json:
|
||||||
|
schema:
|
||||||
|
$ref: '#/components/schemas/Login'
|
||||||
|
# content:
|
||||||
|
# "*/*":
|
||||||
|
# schema:
|
||||||
|
# $ref: "#/components/schemas/Login"
|
||||||
|
tags:
|
||||||
|
- login
|
||||||
|
# parameters:
|
||||||
|
# username: spaceti
|
||||||
|
# password: E7FEA07DBC82FB9BA34B2E453E2EFE89F0583E7187543507EF11E84726071FE428445372F2E46B455EB0C79747C51E362F403CE39473A2A8C2DFA0CE5C9826C0
|
||||||
|
responses:
|
||||||
|
"200":
|
||||||
|
description: Login success
|
||||||
|
content:
|
||||||
|
application/json:
|
||||||
|
schema:
|
||||||
|
$ref: "#/components/schemas/Token"
|
||||||
|
"400":
|
||||||
|
description: ""
|
||||||
|
content:
|
||||||
|
application/json:
|
||||||
|
schema:
|
||||||
|
$ref: "#/components/schemas/Token"
|
||||||
|
/SubjectManager/getSubjects:
|
||||||
|
get:
|
||||||
|
summary: Get subjects
|
||||||
|
tags:
|
||||||
|
- user
|
||||||
|
responses:
|
||||||
|
"200":
|
||||||
|
description: xxxxx
|
||||||
|
/TokenManager/getTokens:
|
||||||
|
get:
|
||||||
|
tags:
|
||||||
|
- token
|
||||||
|
responses:
|
||||||
|
"200":
|
||||||
|
description: xxxxx
|
||||||
|
/TokenManager/setTokens:
|
||||||
|
delete:
|
||||||
|
tags:
|
||||||
|
- token
|
||||||
|
responses:
|
||||||
|
"200":
|
||||||
|
description: xxxxx
|
||||||
|
components:
|
||||||
|
securitySchemes:
|
||||||
|
basicAuth: # <-- arbitrary name for the security scheme
|
||||||
|
type: http
|
||||||
|
scheme: basic
|
||||||
|
|
||||||
|
|
||||||
|
# petstore_auth:
|
||||||
|
# type: oauth2
|
||||||
|
# flows:
|
||||||
|
# implicit:
|
||||||
|
# authorizationUrl: http://petstore.swagger.io/oauth/dialog
|
||||||
|
# scopes:
|
||||||
|
# write:pets: modify pets in your account
|
||||||
|
# read:pets: read your pets
|
||||||
|
# api_key:
|
||||||
|
# type: apiKey
|
||||||
|
# name: api_key
|
||||||
|
# in: header
|
||||||
|
schemas:
|
||||||
|
Login:
|
||||||
|
type: object
|
||||||
|
properties:
|
||||||
|
username:
|
||||||
|
type: string
|
||||||
|
example: spaceti
|
||||||
|
password:
|
||||||
|
type: string
|
||||||
|
example: E7FEA07DBC82FB9BA34B2E453E2EFE89F0583E7187543507EF11E84726071FE428445372F2E46B455EB0C79747C51E362F403CE39473A2A8C2DFA0CE5C9826C0
|
||||||
|
|
||||||
|
Token:
|
||||||
|
type: object
|
||||||
|
properties:
|
||||||
|
id:
|
||||||
|
type: string
|
||||||
|
example: spaceti
|
||||||
|
token:
|
||||||
|
type: string
|
||||||
|
example: E7FEA07DBC82FB9BA34B2E453E2EFE89F0583E7187543507EF11E84726071FE428445372F2E46B455EB0C79747C51E362F403CE39473A2A8C2DFA0CE5C9826C0
|
||||||
|
|
||||||
|
# security:
|
||||||
|
# - basicAuth: [d] # <-- use the same name here
|
||||||
30
snowboard.yml
Normal file
30
snowboard.yml
Normal 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>
|
||||||
Loading…
x
Reference in New Issue
Block a user