added /materials route
This commit is contained in:
86
api/api.yaml
Normal file
86
api/api.yaml
Normal file
@ -0,0 +1,86 @@
|
||||
openapi: 3.0.2
|
||||
|
||||
|
||||
info:
|
||||
title: Digital fingerprint of plastics - API
|
||||
version: 1.0.0
|
||||
description: |
|
||||
This API gives access to the project database.<br>
|
||||
Access is restricted. Authentication can be obtained with HTTP Basic Auth using username and password.
|
||||
Data access methods can also be accessed using an API key at the URL ending like ?key=xxx<br>
|
||||
The description lists available authentication methods, also the locks of each method close correspondingly
|
||||
if the entered authentication is allowed.<br><br>
|
||||
There are a number of different user levels: <br>
|
||||
<ul>
|
||||
<li>read: read access to the samples database</li>
|
||||
<li>write: write access to the samples database, users can change only the values they created</li>
|
||||
<li>maintain: functions like changing templates, validating data, changing values of others</li>
|
||||
<li>dev: handling machine learning models</li>
|
||||
<li>admin: user administration</li>
|
||||
</ul>
|
||||
Password policy:
|
||||
<ul>
|
||||
<li>at least one digit</li>
|
||||
<li>at least one lower case letter</li>
|
||||
<li>at least one upper case letter</li>
|
||||
<li>at least one of the following special characters: !"#%&'()*+,-./:;<=>?@[\]^_`{|}~</li>
|
||||
<li>no whitespace</li>
|
||||
<li>at least 8 characters</li>
|
||||
</ul>
|
||||
|
||||
|
||||
|
||||
servers:
|
||||
- url: http://localhost:3000
|
||||
description: local server
|
||||
- url: https://digital-fingerprint-of-plastics-api.apps.de1.bosch-iot-cloud.com/
|
||||
description: server on the BIC
|
||||
|
||||
|
||||
security:
|
||||
- ApiKey: []
|
||||
- BasicAuth: []
|
||||
|
||||
|
||||
tags:
|
||||
- name: /
|
||||
- name: /sample
|
||||
- name: /material
|
||||
- name: /condition
|
||||
- name: /measurement
|
||||
- name: /templates
|
||||
- name: /model
|
||||
- name: /user
|
||||
|
||||
|
||||
paths:
|
||||
allOf:
|
||||
- $ref: 'others.yaml'
|
||||
- $ref: 'sample.yaml'
|
||||
- $ref: 'material.yaml'
|
||||
- $ref: 'condition.yaml'
|
||||
- $ref: 'measurement.yaml'
|
||||
- $ref: 'template.yaml'
|
||||
- $ref: 'model.yaml'
|
||||
- $ref: 'user.yaml'
|
||||
|
||||
|
||||
components:
|
||||
parameters:
|
||||
$ref: 'parameters.yaml'
|
||||
|
||||
schemas:
|
||||
$ref: 'schemas.yaml'
|
||||
|
||||
responses:
|
||||
$ref: 'responses.yaml'
|
||||
|
||||
|
||||
securitySchemes:
|
||||
BasicAuth:
|
||||
type: http
|
||||
scheme: basic
|
||||
ApiKey:
|
||||
type: apiKey
|
||||
in: query
|
||||
name: key
|
73
api/condition.yaml
Normal file
73
api/condition.yaml
Normal file
@ -0,0 +1,73 @@
|
||||
/condition/{id}:
|
||||
parameters:
|
||||
- $ref: 'api.yaml#/components/parameters/Id'
|
||||
get:
|
||||
summary: TODO condition by id
|
||||
description: 'Auth: all, levels: read, write, maintain, dev, admin'
|
||||
tags:
|
||||
- /condition
|
||||
responses:
|
||||
200:
|
||||
description: condition details
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: 'api.yaml#/components/schemas/Condition'
|
||||
400:
|
||||
$ref: 'api.yaml#/components/responses/400'
|
||||
401:
|
||||
$ref: 'api.yaml#/components/responses/401'
|
||||
404:
|
||||
$ref: 'api.yaml#/components/responses/404'
|
||||
500:
|
||||
$ref: 'api.yaml#/components/responses/500'
|
||||
put:
|
||||
summary: TODO add/change condition
|
||||
description: 'Auth: basic, levels: write, maintain, dev, admin'
|
||||
tags:
|
||||
- /condition
|
||||
security:
|
||||
- BasicAuth: []
|
||||
requestBody:
|
||||
required: true
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: 'api.yaml#/components/schemas/Condition'
|
||||
responses:
|
||||
200:
|
||||
description: condition details
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: 'api.yaml#/components/schemas/Condition'
|
||||
400:
|
||||
$ref: 'api.yaml#/components/responses/400'
|
||||
401:
|
||||
$ref: 'api.yaml#/components/responses/401'
|
||||
403:
|
||||
$ref: 'api.yaml#/components/responses/403'
|
||||
404:
|
||||
$ref: 'api.yaml#/components/responses/404'
|
||||
500:
|
||||
$ref: 'api.yaml#/components/responses/500'
|
||||
delete:
|
||||
summary: TODO delete condition
|
||||
description: 'Auth: basic, levels: write, maintain, dev, admin'
|
||||
tags:
|
||||
- /condition
|
||||
security:
|
||||
- BasicAuth: []
|
||||
responses:
|
||||
200:
|
||||
$ref: 'api.yaml#/components/responses/Ok'
|
||||
400:
|
||||
$ref: 'api.yaml#/components/responses/400'
|
||||
401:
|
||||
$ref: 'api.yaml#/components/responses/401'
|
||||
403:
|
||||
$ref: 'api.yaml#/components/responses/403'
|
||||
404:
|
||||
$ref: 'api.yaml#/components/responses/404'
|
||||
500:
|
||||
$ref: 'api.yaml#/components/responses/500'
|
121
api/material.yaml
Normal file
121
api/material.yaml
Normal file
@ -0,0 +1,121 @@
|
||||
/materials:
|
||||
get:
|
||||
summary: lists all materials
|
||||
description: 'Auth: all, levels: read, write, maintain, dev, admin'
|
||||
tags:
|
||||
- /material
|
||||
responses:
|
||||
200:
|
||||
description: all material details
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
type: array
|
||||
items:
|
||||
$ref: 'api.yaml#/components/schemas/Material'
|
||||
401:
|
||||
$ref: 'api.yaml#/components/responses/401'
|
||||
500:
|
||||
$ref: 'api.yaml#/components/responses/500'
|
||||
|
||||
/material/{id}:
|
||||
parameters:
|
||||
- $ref: 'api.yaml#/components/parameters/Id'
|
||||
get:
|
||||
summary: get material details
|
||||
description: 'Auth: all, levels: read, write, maintain, dev, admin'
|
||||
tags:
|
||||
- /material
|
||||
responses:
|
||||
200:
|
||||
description: material details
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: 'api.yaml#/components/schemas/Material'
|
||||
401:
|
||||
$ref: 'api.yaml#/components/responses/401'
|
||||
404:
|
||||
$ref: 'api.yaml#/components/responses/404'
|
||||
500:
|
||||
$ref: 'api.yaml#/components/responses/500'
|
||||
put:
|
||||
summary: TODO change material
|
||||
description: 'Auth: basic, levels: write, maintain, dev, admin'
|
||||
tags:
|
||||
- /material
|
||||
security:
|
||||
- BasicAuth: []
|
||||
requestBody:
|
||||
required: true
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: 'api.yaml#/components/schemas/Material'
|
||||
responses:
|
||||
200:
|
||||
description: material details
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: 'api.yaml#/components/schemas/Material'
|
||||
400:
|
||||
$ref: 'api.yaml#/components/responses/400'
|
||||
401:
|
||||
$ref: 'api.yaml#/components/responses/401'
|
||||
403:
|
||||
$ref: 'api.yaml#/components/responses/403'
|
||||
404:
|
||||
$ref: 'api.yaml#/components/responses/404'
|
||||
500:
|
||||
$ref: 'api.yaml#/components/responses/500'
|
||||
delete:
|
||||
summary: TODO delete material
|
||||
description: 'Auth: basic, levels: write, maintain, dev, admin'
|
||||
tags:
|
||||
- /material
|
||||
security:
|
||||
- BasicAuth: []
|
||||
responses:
|
||||
200:
|
||||
$ref: 'api.yaml#/components/responses/Ok'
|
||||
400:
|
||||
$ref: 'api.yaml#/components/responses/400'
|
||||
401:
|
||||
$ref: 'api.yaml#/components/responses/401'
|
||||
403:
|
||||
$ref: 'api.yaml#/components/responses/403'
|
||||
404:
|
||||
$ref: 'api.yaml#/components/responses/404'
|
||||
500:
|
||||
$ref: 'api.yaml#/components/responses/500'
|
||||
|
||||
/material/new:
|
||||
post:
|
||||
summary: TODO add material
|
||||
description: 'Auth: basic, levels: write, maintain, dev, admin'
|
||||
tags:
|
||||
- /material
|
||||
security:
|
||||
- BasicAuth: []
|
||||
requestBody:
|
||||
required: true
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: 'api.yaml#/components/schemas/Material'
|
||||
responses:
|
||||
200:
|
||||
description: material details
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: 'api.yaml#/components/schemas/Material'
|
||||
400:
|
||||
$ref: 'api.yaml#/components/responses/400'
|
||||
401:
|
||||
$ref: 'api.yaml#/components/responses/401'
|
||||
403:
|
||||
$ref: 'api.yaml#/components/responses/403'
|
||||
500:
|
||||
$ref: 'api.yaml#/components/responses/500'
|
73
api/measurement.yaml
Normal file
73
api/measurement.yaml
Normal file
@ -0,0 +1,73 @@
|
||||
/measurement/{id}:
|
||||
parameters:
|
||||
- $ref: 'api.yaml#/components/parameters/Id'
|
||||
get:
|
||||
summary: TODO measurement values by id
|
||||
description: 'Auth: all, levels: read, write, maintain, dev, admin'
|
||||
tags:
|
||||
- /measurement
|
||||
responses:
|
||||
200:
|
||||
description: measurement details
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: 'api.yaml#/components/schemas/Measurement'
|
||||
400:
|
||||
$ref: 'api.yaml#/components/responses/400'
|
||||
401:
|
||||
$ref: 'api.yaml#/components/responses/401'
|
||||
404:
|
||||
$ref: 'api.yaml#/components/responses/404'
|
||||
500:
|
||||
$ref: 'api.yaml#/components/responses/500'
|
||||
put:
|
||||
summary: TODO add/change measurement
|
||||
description: 'Auth: basic, levels: write, maintain, dev, admin'
|
||||
tags:
|
||||
- /measurement
|
||||
security:
|
||||
- BasicAuth: []
|
||||
requestBody:
|
||||
required: true
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: 'api.yaml#/components/schemas/Measurement'
|
||||
responses:
|
||||
200:
|
||||
description: measurement details
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: 'api.yaml#/components/schemas/Measurement'
|
||||
400:
|
||||
$ref: 'api.yaml#/components/responses/400'
|
||||
401:
|
||||
$ref: 'api.yaml#/components/responses/401'
|
||||
403:
|
||||
$ref: 'api.yaml#/components/responses/403'
|
||||
404:
|
||||
$ref: 'api.yaml#/components/responses/404'
|
||||
500:
|
||||
$ref: 'api.yaml#/components/responses/500'
|
||||
delete:
|
||||
summary: TODO delete measurement
|
||||
description: 'Auth: basic, levels: write, maintain, dev, admin'
|
||||
tags:
|
||||
- /measurement
|
||||
security:
|
||||
- BasicAuth: []
|
||||
responses:
|
||||
200:
|
||||
$ref: 'api.yaml#/components/responses/Ok'
|
||||
400:
|
||||
$ref: 'api.yaml#/components/responses/400'
|
||||
401:
|
||||
$ref: 'api.yaml#/components/responses/401'
|
||||
403:
|
||||
$ref: 'api.yaml#/components/responses/403'
|
||||
404:
|
||||
$ref: 'api.yaml#/components/responses/404'
|
||||
500:
|
||||
$ref: 'api.yaml#/components/responses/500'
|
70
api/model.yaml
Normal file
70
api/model.yaml
Normal file
@ -0,0 +1,70 @@
|
||||
/model/{name}:
|
||||
parameters:
|
||||
- $ref: 'api.yaml#/components/parameters/Name'
|
||||
get:
|
||||
summary: TODO get model data by name
|
||||
description: 'Auth: all, levels: dev, admin'
|
||||
tags:
|
||||
- /model
|
||||
responses:
|
||||
200:
|
||||
description: binary model data
|
||||
content:
|
||||
application/octet-stream:
|
||||
schema:
|
||||
type: string
|
||||
format: binary
|
||||
401:
|
||||
$ref: 'api.yaml#/components/responses/401'
|
||||
403:
|
||||
$ref: 'api.yaml#/components/responses/403'
|
||||
404:
|
||||
$ref: 'api.yaml#/components/responses/404'
|
||||
500:
|
||||
$ref: 'api.yaml#/components/responses/500'
|
||||
put:
|
||||
summary: TODO add/replace model data by name
|
||||
description: 'Auth: all, levels: dev, admin'
|
||||
tags:
|
||||
- /model
|
||||
requestBody:
|
||||
required: true
|
||||
description: binary model data
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
type: string
|
||||
format: binary
|
||||
responses:
|
||||
200:
|
||||
$ref: 'api.yaml#/components/responses/Ok'
|
||||
400:
|
||||
$ref: 'api.yaml#/components/responses/400'
|
||||
401:
|
||||
$ref: 'api.yaml#/components/responses/401'
|
||||
403:
|
||||
$ref: 'api.yaml#/components/responses/403'
|
||||
404:
|
||||
$ref: 'api.yaml#/components/responses/404'
|
||||
500:
|
||||
$ref: 'api.yaml#/components/responses/500'
|
||||
delete:
|
||||
summary: TODO delete model data
|
||||
description: 'Auth: basic, levels: dev, admin'
|
||||
tags:
|
||||
- /model
|
||||
security:
|
||||
- BasicAuth: []
|
||||
responses:
|
||||
200:
|
||||
$ref: 'api.yaml#/components/responses/Ok'
|
||||
400:
|
||||
$ref: 'api.yaml#/components/responses/400'
|
||||
401:
|
||||
$ref: 'api.yaml#/components/responses/401'
|
||||
403:
|
||||
$ref: 'api.yaml#/components/responses/403'
|
||||
404:
|
||||
$ref: 'api.yaml#/components/responses/404'
|
||||
500:
|
||||
$ref: 'api.yaml#/components/responses/500'
|
43
api/others.yaml
Normal file
43
api/others.yaml
Normal file
@ -0,0 +1,43 @@
|
||||
/:
|
||||
get:
|
||||
summary: Root method
|
||||
description: 'Auth: none'
|
||||
tags:
|
||||
- /
|
||||
security: []
|
||||
responses:
|
||||
200:
|
||||
description: Server is working
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
properties:
|
||||
status:
|
||||
type: string
|
||||
example: 'API server up and running!'
|
||||
500:
|
||||
$ref: 'api.yaml#/components/responses/500'
|
||||
|
||||
/authorized:
|
||||
get:
|
||||
summary: Checks authorization
|
||||
description: 'Auth: all, levels: read, write, maintain, dev, admin'
|
||||
tags:
|
||||
- /
|
||||
responses:
|
||||
200:
|
||||
description: Authorized
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
properties:
|
||||
status:
|
||||
type: string
|
||||
example: 'Authorization successful'
|
||||
method:
|
||||
type: string
|
||||
example: 'basic'
|
||||
401:
|
||||
$ref: 'api.yaml#/components/responses/401'
|
||||
500:
|
||||
$ref: 'api.yaml#/components/responses/500'
|
13
api/parameters.yaml
Normal file
13
api/parameters.yaml
Normal file
@ -0,0 +1,13 @@
|
||||
Id:
|
||||
name: id
|
||||
in: path
|
||||
required: true
|
||||
schema:
|
||||
type: string
|
||||
example: 5ea0450ed851c30a90e70894
|
||||
Name:
|
||||
name: name
|
||||
in: path
|
||||
required: true
|
||||
schema:
|
||||
type: string
|
54
api/responses.yaml
Normal file
54
api/responses.yaml
Normal file
@ -0,0 +1,54 @@
|
||||
400:
|
||||
description: Bad request
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
properties:
|
||||
status:
|
||||
type: string
|
||||
example: 'Bad request'
|
||||
401:
|
||||
description: Unauthorized
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
properties:
|
||||
status:
|
||||
type: string
|
||||
example: 'Unauthorized'
|
||||
403:
|
||||
description: Forbidden
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
properties:
|
||||
status:
|
||||
type: string
|
||||
example: 'Forbidden'
|
||||
404:
|
||||
description: Not found
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
properties:
|
||||
status:
|
||||
type: string
|
||||
example: 'Not found'
|
||||
500:
|
||||
description: Internal server error
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
properties:
|
||||
status:
|
||||
type: string
|
||||
example: 'Internal server error'
|
||||
Ok:
|
||||
description: request executed successfully
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
properties:
|
||||
status:
|
||||
type: string
|
||||
example: OK
|
112
api/sample.yaml
Normal file
112
api/sample.yaml
Normal file
@ -0,0 +1,112 @@
|
||||
/samples:
|
||||
get:
|
||||
summary: TODO all samples in overview
|
||||
description: 'Auth: all, levels: read, write, maintain, dev, admin'
|
||||
tags:
|
||||
- /sample
|
||||
responses:
|
||||
200:
|
||||
description: samples overview
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: 'api.yaml#/components/schemas/Samples'
|
||||
401:
|
||||
$ref: 'api.yaml#/components/responses/401'
|
||||
500:
|
||||
$ref: 'api.yaml#/components/responses/500'
|
||||
/sample/{id}:
|
||||
parameters:
|
||||
- $ref: 'api.yaml#/components/parameters/Id'
|
||||
get:
|
||||
summary: TODO sample details
|
||||
description: 'Auth: all, levels: read, write, maintain, dev, admin'
|
||||
tags:
|
||||
- /sample
|
||||
responses:
|
||||
200:
|
||||
description: samples details
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: 'api.yaml#/components/schemas/SampleDetail'
|
||||
400:
|
||||
$ref: 'api.yaml#/components/responses/400'
|
||||
401:
|
||||
$ref: 'api.yaml#/components/responses/401'
|
||||
404:
|
||||
$ref: 'api.yaml#/components/responses/404'
|
||||
500:
|
||||
$ref: 'api.yaml#/components/responses/500'
|
||||
put:
|
||||
summary: TODO add/change sample
|
||||
description: 'Auth: basic, levels: write, maintain, dev, admin'
|
||||
tags:
|
||||
- /sample
|
||||
security:
|
||||
- BasicAuth: []
|
||||
requestBody:
|
||||
required: true
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: 'api.yaml#/components/schemas/Sample'
|
||||
responses:
|
||||
200:
|
||||
description: samples details
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: 'api.yaml#/components/schemas/SampleDetail'
|
||||
400:
|
||||
$ref: 'api.yaml#/components/responses/400'
|
||||
401:
|
||||
$ref: 'api.yaml#/components/responses/401'
|
||||
403:
|
||||
$ref: 'api.yaml#/components/responses/403'
|
||||
404:
|
||||
$ref: 'api.yaml#/components/responses/404'
|
||||
500:
|
||||
$ref: 'api.yaml#/components/responses/500'
|
||||
delete:
|
||||
summary: TODO delete sample
|
||||
description: 'Auth: basic, levels: write, maintain, dev, admin'
|
||||
tags:
|
||||
- /sample
|
||||
security:
|
||||
- BasicAuth: []
|
||||
responses:
|
||||
200:
|
||||
$ref: 'api.yaml#/components/responses/Ok'
|
||||
400:
|
||||
$ref: 'api.yaml#/components/responses/400'
|
||||
401:
|
||||
$ref: 'api.yaml#/components/responses/401'
|
||||
403:
|
||||
$ref: 'api.yaml#/components/responses/403'
|
||||
404:
|
||||
$ref: 'api.yaml#/components/responses/404'
|
||||
500:
|
||||
$ref: 'api.yaml#/components/responses/500'
|
||||
/sample/notes/fields:
|
||||
get:
|
||||
summary: TODO list all existing field names for custom notes fields
|
||||
description: 'Auth: all, levels: write, maintain, dev, admin'
|
||||
tags:
|
||||
- /sample
|
||||
responses:
|
||||
200:
|
||||
description: field names and quantity of usage
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
properties:
|
||||
name:
|
||||
type: string
|
||||
qty:
|
||||
type: number
|
||||
example: 20
|
||||
401:
|
||||
$ref: 'api.yaml#/components/responses/401'
|
||||
500:
|
||||
$ref: 'api.yaml#/components/responses/500'
|
176
api/schemas.yaml
Normal file
176
api/schemas.yaml
Normal file
@ -0,0 +1,176 @@
|
||||
Id:
|
||||
type: string
|
||||
example: 5ea0450ed851c30a90e70894
|
||||
_Id:
|
||||
properties:
|
||||
_id:
|
||||
allOf:
|
||||
- $ref: 'api.yaml#/components/schemas/Id'
|
||||
readOnly: true
|
||||
Color:
|
||||
properties:
|
||||
color:
|
||||
type: string
|
||||
example: black
|
||||
SampleProperties:
|
||||
properties:
|
||||
sample_number:
|
||||
type: string
|
||||
type:
|
||||
type: string
|
||||
batch:
|
||||
type: string
|
||||
validated:
|
||||
type: boolean
|
||||
|
||||
Samples:
|
||||
allOf:
|
||||
- $ref: 'api.yaml#/components/schemas/_Id'
|
||||
- $ref: 'api.yaml#/components/schemas/Color'
|
||||
- $ref: 'api.yaml#/components/schemas/SampleProperties'
|
||||
properties:
|
||||
material_id:
|
||||
$ref: 'api.yaml#/components/schemas/Id'
|
||||
note_id:
|
||||
$ref: 'api.yaml#/components/schemas/Id'
|
||||
user_id:
|
||||
$ref: 'api.yaml#/components/schemas/Id'
|
||||
Sample:
|
||||
allOf:
|
||||
- $ref: 'api.yaml#/components/schemas/_Id'
|
||||
- $ref: 'api.yaml#/components/schemas/Color'
|
||||
- $ref: 'api.yaml#/components/schemas/SampleProperties'
|
||||
properties:
|
||||
material:
|
||||
$ref: 'api.yaml#/components/schemas/Material'
|
||||
notes:
|
||||
type: object
|
||||
properties:
|
||||
comments:
|
||||
type: string
|
||||
sample_references:
|
||||
type: array
|
||||
items:
|
||||
$ref: 'api.yaml#/components/schemas/Id'
|
||||
SampleDetail:
|
||||
allOf:
|
||||
- $ref: 'api.yaml#/components/schemas/_Id'
|
||||
- $ref: 'api.yaml#/components/schemas/Color'
|
||||
- $ref: 'api.yaml#/components/schemas/SampleProperties'
|
||||
properties:
|
||||
material:
|
||||
$ref: 'api.yaml#/components/schemas/Material'
|
||||
notes:
|
||||
type: object
|
||||
properties:
|
||||
comments:
|
||||
type: string
|
||||
sample_references:
|
||||
type: array
|
||||
items:
|
||||
$ref: 'api.yaml#/components/schemas/Id'
|
||||
conditions:
|
||||
type: array
|
||||
items:
|
||||
$ref: 'api.yaml#/components/schemas/Condition'
|
||||
|
||||
Material:
|
||||
allOf:
|
||||
- $ref: 'api.yaml#/components/schemas/_Id'
|
||||
properties:
|
||||
name:
|
||||
type: string
|
||||
example: Stanyl TW 200 F8
|
||||
supplier:
|
||||
type: string
|
||||
example: DSM
|
||||
group:
|
||||
type: string
|
||||
example: PA46
|
||||
mineral:
|
||||
type: number
|
||||
example: 0
|
||||
glass_fiber:
|
||||
type: number
|
||||
example: 40
|
||||
carbon_fiber:
|
||||
type: number
|
||||
example: 0
|
||||
numbers:
|
||||
type: array
|
||||
items:
|
||||
type: object
|
||||
allOf:
|
||||
- $ref: 'api.yaml#/components/schemas/Color'
|
||||
properties:
|
||||
number:
|
||||
type: number
|
||||
example: 5514263423
|
||||
|
||||
Condition:
|
||||
allOf:
|
||||
- $ref: 'api.yaml#/components/schemas/_Id'
|
||||
properties:
|
||||
sample_id:
|
||||
$ref: 'api.yaml#/components/schemas/Id'
|
||||
parameters:
|
||||
type: object
|
||||
treatment_template:
|
||||
$ref: 'api.yaml#/components/schemas/Id'
|
||||
|
||||
Measurement:
|
||||
allOf:
|
||||
- $ref: 'api.yaml#/components/schemas/_Id'
|
||||
properties:
|
||||
condition_id:
|
||||
$ref: 'api.yaml#/components/schemas/Id'
|
||||
values:
|
||||
type: object
|
||||
measurement_template:
|
||||
$ref: 'api.yaml#/components/schemas/Id'
|
||||
|
||||
Template:
|
||||
allOf:
|
||||
- $ref: 'api.yaml#/components/schemas/_Id'
|
||||
properties:
|
||||
name:
|
||||
type: string
|
||||
parameters:
|
||||
type: array
|
||||
items:
|
||||
type: object
|
||||
properties:
|
||||
name:
|
||||
type: string
|
||||
range:
|
||||
type: object
|
||||
|
||||
Email:
|
||||
properties:
|
||||
email:
|
||||
type: string
|
||||
example: john.doe@bosch.com
|
||||
UserName:
|
||||
properties:
|
||||
name:
|
||||
type: string
|
||||
example: johndoe
|
||||
User:
|
||||
allOf:
|
||||
- $ref: 'api.yaml#/components/schemas/_Id'
|
||||
- $ref: 'api.yaml#/components/schemas/UserName'
|
||||
- $ref: 'api.yaml#/components/schemas/Email'
|
||||
properties:
|
||||
pass:
|
||||
type: string
|
||||
writeOnly: true
|
||||
example: Abc123!#
|
||||
level:
|
||||
type: string
|
||||
example: read
|
||||
location:
|
||||
type: string
|
||||
example: Rng
|
||||
device_name:
|
||||
type: string
|
||||
example: Alpha II
|
250
api/template.yaml
Normal file
250
api/template.yaml
Normal file
@ -0,0 +1,250 @@
|
||||
/template/treatments:
|
||||
get:
|
||||
summary: TODO all available treatment methods
|
||||
description: 'Auth: basic, levels: read, write, maintain, dev, admin'
|
||||
tags:
|
||||
- /templates
|
||||
security:
|
||||
- BasicAuth: []
|
||||
responses:
|
||||
200:
|
||||
description: list of treatments
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
type: array
|
||||
items:
|
||||
$ref: 'api.yaml#/components/schemas/Template'
|
||||
example:
|
||||
name: heat aging
|
||||
parameters:
|
||||
- name: method
|
||||
range:
|
||||
- copper
|
||||
401:
|
||||
$ref: 'api.yaml#/components/responses/401'
|
||||
500:
|
||||
$ref: 'api.yaml#/components/responses/500'
|
||||
/templates/treatment/{name}:
|
||||
parameters:
|
||||
- $ref: 'api.yaml#/components/parameters/Name'
|
||||
get:
|
||||
summary: TODO treatment method details
|
||||
description: 'Auth: basic, levels: read, write, maintain, admin'
|
||||
tags:
|
||||
- /templates
|
||||
security:
|
||||
- BasicAuth: []
|
||||
responses:
|
||||
200:
|
||||
description: treatment details
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
allOf:
|
||||
- $ref: 'api.yaml#/components/schemas/Template'
|
||||
example:
|
||||
name: heat aging
|
||||
parameters:
|
||||
- name: method
|
||||
range:
|
||||
- copper
|
||||
400:
|
||||
$ref: 'api.yaml#/components/responses/400'
|
||||
401:
|
||||
$ref: 'api.yaml#/components/responses/401'
|
||||
404:
|
||||
$ref: 'api.yaml#/components/responses/404'
|
||||
500:
|
||||
$ref: 'api.yaml#/components/responses/500'
|
||||
put:
|
||||
summary: TODO add/change treatment method
|
||||
description: 'Auth: basic, levels: maintain, admin'
|
||||
tags:
|
||||
- /templates
|
||||
security:
|
||||
- BasicAuth: []
|
||||
requestBody:
|
||||
required: true
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
allOf:
|
||||
- $ref: 'api.yaml#/components/schemas/Template'
|
||||
example:
|
||||
name: heat aging
|
||||
parameters:
|
||||
- name: method
|
||||
range:
|
||||
- copper
|
||||
responses:
|
||||
200:
|
||||
description: treatment details
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
allOf:
|
||||
- $ref: 'api.yaml#/components/schemas/Template'
|
||||
example:
|
||||
name: heat aging
|
||||
parameters:
|
||||
- name: method
|
||||
range:
|
||||
- copper
|
||||
400:
|
||||
$ref: 'api.yaml#/components/responses/400'
|
||||
401:
|
||||
$ref: 'api.yaml#/components/responses/401'
|
||||
403:
|
||||
$ref: 'api.yaml#/components/responses/403'
|
||||
404:
|
||||
$ref: 'api.yaml#/components/responses/404'
|
||||
500:
|
||||
$ref: 'api.yaml#/components/responses/500'
|
||||
delete:
|
||||
summary: TODO delete treatment method
|
||||
description: 'Auth: basic, levels: maintain, admin'
|
||||
tags:
|
||||
- /templates
|
||||
security:
|
||||
- BasicAuth: []
|
||||
responses:
|
||||
200:
|
||||
$ref: 'api.yaml#/components/responses/Ok'
|
||||
400:
|
||||
$ref: 'api.yaml#/components/responses/400'
|
||||
401:
|
||||
$ref: 'api.yaml#/components/responses/401'
|
||||
403:
|
||||
$ref: 'api.yaml#/components/responses/403'
|
||||
404:
|
||||
$ref: 'api.yaml#/components/responses/404'
|
||||
500:
|
||||
$ref: 'api.yaml#/components/responses/500'
|
||||
/template/measurements:
|
||||
get:
|
||||
summary: TODO all available measurement methods
|
||||
description: 'Auth: basic, levels: read, write, maintain, dev, admin'
|
||||
tags:
|
||||
- /templates
|
||||
security:
|
||||
- BasicAuth: []
|
||||
responses:
|
||||
200:
|
||||
description: list of measurement methods
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
type: array
|
||||
items:
|
||||
$ref: 'api.yaml#/components/schemas/Template'
|
||||
example:
|
||||
name: humidity
|
||||
parameters:
|
||||
- name: kf
|
||||
range:
|
||||
min: 0
|
||||
max: 2
|
||||
401:
|
||||
$ref: 'api.yaml#/components/responses/401'
|
||||
500:
|
||||
$ref: 'api.yaml#/components/responses/500'
|
||||
/templates/measurement/{name}:
|
||||
parameters:
|
||||
- $ref: 'api.yaml#/components/parameters/Name'
|
||||
get:
|
||||
summary: TODO measurement method details
|
||||
description: 'Auth: basic, levels: read, write, maintain, admin'
|
||||
tags:
|
||||
- /templates
|
||||
security:
|
||||
- BasicAuth: []
|
||||
responses:
|
||||
200:
|
||||
description: measurement details
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
allOf:
|
||||
- $ref: 'api.yaml#/components/schemas/Template'
|
||||
example:
|
||||
name: humidity
|
||||
parameters:
|
||||
- name: kf
|
||||
range:
|
||||
min: 0
|
||||
max: 2
|
||||
400:
|
||||
$ref: 'api.yaml#/components/responses/400'
|
||||
401:
|
||||
$ref: 'api.yaml#/components/responses/401'
|
||||
404:
|
||||
$ref: 'api.yaml#/components/responses/404'
|
||||
500:
|
||||
$ref: 'api.yaml#/components/responses/500'
|
||||
put:
|
||||
summary: TODO add/change measurement method
|
||||
description: 'Auth: basic, levels: maintain, admin'
|
||||
tags:
|
||||
- /templates
|
||||
security:
|
||||
- BasicAuth: []
|
||||
requestBody:
|
||||
required: true
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
allOf:
|
||||
- $ref: 'api.yaml#/components/schemas/Template'
|
||||
example:
|
||||
name: humidity
|
||||
parameters:
|
||||
- name: kf
|
||||
range:
|
||||
min: 0
|
||||
max: 2
|
||||
responses:
|
||||
200:
|
||||
description: measurement details
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
allOf:
|
||||
- $ref: 'api.yaml#/components/schemas/Template'
|
||||
example:
|
||||
name: humidity
|
||||
parameters:
|
||||
- name: kf
|
||||
range:
|
||||
min: 0
|
||||
max: 2
|
||||
400:
|
||||
$ref: 'api.yaml#/components/responses/400'
|
||||
401:
|
||||
$ref: 'api.yaml#/components/responses/401'
|
||||
403:
|
||||
$ref: 'api.yaml#/components/responses/403'
|
||||
404:
|
||||
$ref: 'api.yaml#/components/responses/404'
|
||||
500:
|
||||
$ref: 'api.yaml#/components/responses/500'
|
||||
delete:
|
||||
summary: TODO delete measurement method
|
||||
description: 'Auth: basic, levels: maintain, admin'
|
||||
tags:
|
||||
- /templates
|
||||
security:
|
||||
- BasicAuth: []
|
||||
responses:
|
||||
200:
|
||||
$ref: 'api.yaml#/components/responses/Ok'
|
||||
400:
|
||||
$ref: 'api.yaml#/components/responses/400'
|
||||
401:
|
||||
$ref: 'api.yaml#/components/responses/401'
|
||||
403:
|
||||
$ref: 'api.yaml#/components/responses/403'
|
||||
404:
|
||||
$ref: 'api.yaml#/components/responses/404'
|
||||
500:
|
||||
$ref: 'api.yaml#/components/responses/500'
|
255
api/user.yaml
Normal file
255
api/user.yaml
Normal file
@ -0,0 +1,255 @@
|
||||
/users:
|
||||
get:
|
||||
summary: lists all users
|
||||
description: 'Auth: basic, levels: admin'
|
||||
tags:
|
||||
- /user
|
||||
security:
|
||||
- BasicAuth: []
|
||||
responses:
|
||||
200:
|
||||
description: user API key
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
type: array
|
||||
items:
|
||||
$ref: 'api.yaml#/components/schemas/User'
|
||||
401:
|
||||
$ref: 'api.yaml#/components/responses/401'
|
||||
403:
|
||||
$ref: 'api.yaml#/components/responses/403'
|
||||
500:
|
||||
$ref: 'api.yaml#/components/responses/500'
|
||||
/user:
|
||||
get:
|
||||
summary: list own user details
|
||||
description: 'Auth: basic, levels: read, write, maintain, admin'
|
||||
tags:
|
||||
- /user
|
||||
security:
|
||||
- BasicAuth: []
|
||||
responses:
|
||||
200:
|
||||
description: user details
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: 'api.yaml#/components/schemas/User'
|
||||
401:
|
||||
$ref: 'api.yaml#/components/responses/401'
|
||||
403:
|
||||
$ref: 'api.yaml#/components/responses/403'
|
||||
500:
|
||||
$ref: 'api.yaml#/components/responses/500'
|
||||
put:
|
||||
summary: change user details
|
||||
description: 'Auth: basic, levels: read, write, maintain, admin'
|
||||
tags:
|
||||
- /user
|
||||
security:
|
||||
- BasicAuth: []
|
||||
requestBody:
|
||||
required: true
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
allOf:
|
||||
- $ref: 'api.yaml#/components/schemas/_Id'
|
||||
- $ref: 'api.yaml#/components/schemas/UserName'
|
||||
- $ref: 'api.yaml#/components/schemas/Email'
|
||||
properties:
|
||||
pass:
|
||||
type: string
|
||||
writeOnly: true
|
||||
example: Abc123!#
|
||||
location:
|
||||
type: string
|
||||
example: Rng
|
||||
device_name:
|
||||
type: string
|
||||
example: Alpha II
|
||||
responses:
|
||||
200:
|
||||
description: user details
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: 'api.yaml#/components/schemas/User'
|
||||
400:
|
||||
$ref: 'api.yaml#/components/responses/400'
|
||||
401:
|
||||
$ref: 'api.yaml#/components/responses/401'
|
||||
403:
|
||||
$ref: 'api.yaml#/components/responses/403'
|
||||
500:
|
||||
$ref: 'api.yaml#/components/responses/500'
|
||||
delete:
|
||||
summary: delete user
|
||||
description: 'Auth: basic, levels: read, write, maintain, admin'
|
||||
tags:
|
||||
- /user
|
||||
security:
|
||||
- BasicAuth: []
|
||||
responses:
|
||||
200:
|
||||
$ref: 'api.yaml#/components/responses/Ok'
|
||||
401:
|
||||
$ref: 'api.yaml#/components/responses/401'
|
||||
500:
|
||||
$ref: 'api.yaml#/components/responses/500'
|
||||
/user/{name}:
|
||||
parameters:
|
||||
- $ref: 'api.yaml#/components/parameters/Name'
|
||||
get:
|
||||
summary: list user details
|
||||
description: 'Auth: basic, levels: admin'
|
||||
tags:
|
||||
- /user
|
||||
security:
|
||||
- BasicAuth: []
|
||||
responses:
|
||||
200:
|
||||
description: user details
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: 'api.yaml#/components/schemas/User'
|
||||
401:
|
||||
$ref: 'api.yaml#/components/responses/401'
|
||||
403:
|
||||
$ref: 'api.yaml#/components/responses/403'
|
||||
404:
|
||||
$ref: 'api.yaml#/components/responses/404'
|
||||
500:
|
||||
$ref: 'api.yaml#/components/responses/500'
|
||||
put:
|
||||
summary: change user details
|
||||
description: 'Auth: basic, levels: admin'
|
||||
tags:
|
||||
- /user
|
||||
security:
|
||||
- BasicAuth: []
|
||||
requestBody:
|
||||
required: true
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: 'api.yaml#/components/schemas/User'
|
||||
responses:
|
||||
200:
|
||||
description: user details
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: 'api.yaml#/components/schemas/User'
|
||||
400:
|
||||
$ref: 'api.yaml#/components/responses/400'
|
||||
401:
|
||||
$ref: 'api.yaml#/components/responses/401'
|
||||
403:
|
||||
$ref: 'api.yaml#/components/responses/403'
|
||||
404:
|
||||
$ref: 'api.yaml#/components/responses/404'
|
||||
500:
|
||||
$ref: 'api.yaml#/components/responses/500'
|
||||
delete:
|
||||
summary: delete user
|
||||
description: 'Auth: basic, levels: admin'
|
||||
tags:
|
||||
- /user
|
||||
security:
|
||||
- BasicAuth: []
|
||||
responses:
|
||||
200:
|
||||
$ref: 'api.yaml#/components/responses/Ok'
|
||||
401:
|
||||
$ref: 'api.yaml#/components/responses/401'
|
||||
403:
|
||||
$ref: 'api.yaml#/components/responses/403'
|
||||
404:
|
||||
$ref: 'api.yaml#/components/responses/404'
|
||||
500:
|
||||
$ref: 'api.yaml#/components/responses/500'
|
||||
/user/key:
|
||||
get:
|
||||
summary: get API key for the user
|
||||
description: 'Auth: basic, levels: read, write, maintain, dev, admin'
|
||||
tags:
|
||||
- /user
|
||||
security:
|
||||
- BasicAuth: []
|
||||
responses:
|
||||
200:
|
||||
description: user details
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
properties:
|
||||
key:
|
||||
type: string
|
||||
example: 5ea0450ed851c30a90e70899
|
||||
401:
|
||||
$ref: 'api.yaml#/components/responses/401'
|
||||
500:
|
||||
$ref: 'api.yaml#/components/responses/500'
|
||||
/user/new:
|
||||
post:
|
||||
summary: add new user
|
||||
description: 'Auth: basic, levels: admin'
|
||||
tags:
|
||||
- /user
|
||||
security:
|
||||
- BasicAuth: []
|
||||
requestBody:
|
||||
required: true
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
required:
|
||||
- email
|
||||
- name
|
||||
- pass
|
||||
- level
|
||||
- location
|
||||
- device_name
|
||||
allOf:
|
||||
- $ref: 'api.yaml#/components/schemas/User'
|
||||
responses:
|
||||
200:
|
||||
description: user details
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: 'api.yaml#/components/schemas/User'
|
||||
400:
|
||||
$ref: 'api.yaml#/components/responses/400'
|
||||
401:
|
||||
$ref: 'api.yaml#/components/responses/401'
|
||||
403:
|
||||
$ref: 'api.yaml#/components/responses/403'
|
||||
500:
|
||||
$ref: 'api.yaml#/components/responses/500'
|
||||
/user/passreset:
|
||||
post:
|
||||
summary: reset password and send mail to restore
|
||||
description: 'Auth: none'
|
||||
tags:
|
||||
- /user
|
||||
security: []
|
||||
requestBody:
|
||||
required: true
|
||||
description: mail saved in user profile to provide authentication
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
allOf:
|
||||
- $ref: 'api.yaml#/components/schemas/UserName'
|
||||
- $ref: 'api.yaml#/components/schemas/Email'
|
||||
responses:
|
||||
200:
|
||||
$ref: 'api.yaml#/components/responses/Ok'
|
||||
404:
|
||||
$ref: 'api.yaml#/components/responses/404'
|
||||
500:
|
||||
$ref: 'api.yaml#/components/responses/500'
|
Reference in New Issue
Block a user