2020-04-21 10:53:07 +02:00
|
|
|
/samples:
|
|
|
|
get:
|
2020-05-06 14:39:04 +02:00
|
|
|
summary: all samples in overview
|
2020-08-05 18:28:27 +02:00
|
|
|
description: 'Auth: all, levels: read, write, dev, admin, spectral data can only be accessed by dev and admin'
|
|
|
|
x-doc: 'Limitations: paging and csv output does not work when including the spectrum measurement fields as well as
|
|
|
|
the returned number of total samples'
|
2020-04-21 10:53:07 +02:00
|
|
|
tags:
|
|
|
|
- /sample
|
2020-06-15 12:49:32 +02:00
|
|
|
parameters:
|
|
|
|
- name: status
|
|
|
|
description: 'values: validated|new|all, defaults to validated'
|
|
|
|
in: query
|
|
|
|
schema:
|
|
|
|
type: string
|
|
|
|
example: all
|
2020-06-25 11:59:36 +02:00
|
|
|
- name: from-id
|
|
|
|
description: first id of the requested page, if not given the results are displayed from start
|
2020-06-25 10:44:55 +02:00
|
|
|
in: query
|
|
|
|
schema:
|
|
|
|
type: string
|
|
|
|
example: 5ea0450ed851c30a90e70894
|
|
|
|
- name: to-page
|
2020-08-05 18:28:27 +02:00
|
|
|
description: 'relative change of pages, use negative values to get back, defaults to 0, works only together with
|
|
|
|
page-size'
|
2020-06-25 10:44:55 +02:00
|
|
|
in: query
|
|
|
|
schema:
|
|
|
|
type: string
|
|
|
|
example: 1
|
|
|
|
- name: page-size
|
|
|
|
description: number of items per page
|
|
|
|
in: query
|
|
|
|
schema:
|
|
|
|
type: string
|
|
|
|
example: 30
|
2020-06-26 09:38:28 +02:00
|
|
|
- name: sort
|
|
|
|
description: sorting of results, in format 'key-asc/desc'
|
|
|
|
in: query
|
|
|
|
schema:
|
|
|
|
type: string
|
|
|
|
example: color-asc
|
2020-06-29 12:27:39 +02:00
|
|
|
- name: csv
|
|
|
|
description: output as csv
|
|
|
|
in: query
|
|
|
|
schema:
|
|
|
|
type: boolean
|
|
|
|
example: false
|
2020-06-30 14:16:37 +02:00
|
|
|
- name: fields[]
|
2020-08-05 18:28:27 +02:00
|
|
|
description: "the fields to include in the output as array, defaults to ['_id', 'number', 'type',
|
|
|
|
'batch', 'material_id', 'color', 'condition', 'note_id', 'user_id', 'added']"
|
2020-06-29 15:50:24 +02:00
|
|
|
in: query
|
|
|
|
schema:
|
2020-06-30 14:16:37 +02:00
|
|
|
type: array
|
|
|
|
items:
|
|
|
|
type: string
|
|
|
|
example: ['number', 'batch']
|
2020-07-06 09:43:04 +02:00
|
|
|
- name: filters[]
|
2020-08-05 18:28:27 +02:00
|
|
|
description: "the filters to apply as an array of URIComponent encoded objects in the form {mode:
|
|
|
|
'eq/ne/lt/lte/gt/gte/in/nin', field: 'material.m', values: ['15']} using encodeURIComponent(JSON.stringify({}))"
|
2020-07-06 09:43:04 +02:00
|
|
|
in: query
|
|
|
|
schema:
|
|
|
|
type: array
|
|
|
|
items:
|
|
|
|
type: string
|
2020-08-05 18:28:27 +02:00
|
|
|
example: '["%7B%22mode%22%3A%22eq%22%2C%22field%22%3A%22material.m%22%2C%22values%22%3A%5B%2215%22%5D%7D",
|
|
|
|
"%7B%22mode%22%3A%22isin%22%2C%22field%22%3A%22material.supplier%22%2C%22values%22%3A%5B%22BASF%22%2C%22DSM%22
|
|
|
|
%5D%7D"]'
|
2020-04-21 10:53:07 +02:00
|
|
|
responses:
|
|
|
|
200:
|
2020-08-06 18:50:50 +02:00
|
|
|
description: samples overview (output depends on the fields specified)<br>
|
|
|
|
if the csv parameter is set, this is in CSV instead of JSON format
|
2020-07-09 13:48:27 +02:00
|
|
|
headers:
|
2020-07-09 16:30:10 +02:00
|
|
|
x-total-items:
|
2020-08-05 18:28:27 +02:00
|
|
|
description: Total number of available items when from-id is not specified and spectrum field is not
|
|
|
|
included
|
2020-07-09 13:48:27 +02:00
|
|
|
schema:
|
|
|
|
type: integer
|
|
|
|
example: 243
|
2020-04-21 10:53:07 +02:00
|
|
|
content:
|
|
|
|
application/json:
|
|
|
|
schema:
|
2020-05-06 14:39:04 +02:00
|
|
|
type: array
|
|
|
|
items:
|
2020-08-06 18:50:50 +02:00
|
|
|
$ref: 'api.yaml#/components/schemas/SampleDetail'
|
2020-06-15 12:49:32 +02:00
|
|
|
400:
|
|
|
|
$ref: 'api.yaml#/components/responses/400'
|
2020-04-21 10:53:07 +02:00
|
|
|
401:
|
2020-04-29 12:10:27 +02:00
|
|
|
$ref: 'api.yaml#/components/responses/401'
|
2020-06-25 10:44:55 +02:00
|
|
|
404:
|
|
|
|
$ref: 'api.yaml#/components/responses/404'
|
2020-04-21 10:53:07 +02:00
|
|
|
500:
|
2020-04-29 12:10:27 +02:00
|
|
|
$ref: 'api.yaml#/components/responses/500'
|
2020-05-18 14:47:22 +02:00
|
|
|
|
2020-05-28 17:05:23 +02:00
|
|
|
/samples/{state}:
|
2020-05-18 14:47:22 +02:00
|
|
|
parameters:
|
2020-05-28 17:05:23 +02:00
|
|
|
- $ref: 'api.yaml#/components/parameters/State'
|
2020-05-18 14:47:22 +02:00
|
|
|
get:
|
|
|
|
summary: all new/deleted samples in overview
|
2020-08-05 18:28:27 +02:00
|
|
|
description: 'Auth: basic, levels: admin'
|
2020-05-18 14:47:22 +02:00
|
|
|
x-doc: returns only samples with status 0/-1
|
|
|
|
tags:
|
|
|
|
- /sample
|
|
|
|
responses:
|
|
|
|
200:
|
|
|
|
description: samples overview
|
|
|
|
content:
|
|
|
|
application/json:
|
|
|
|
schema:
|
|
|
|
type: array
|
|
|
|
items:
|
|
|
|
$ref: 'api.yaml#/components/schemas/SampleRefs'
|
|
|
|
401:
|
|
|
|
$ref: 'api.yaml#/components/responses/401'
|
|
|
|
500:
|
|
|
|
$ref: 'api.yaml#/components/responses/500'
|
|
|
|
|
2020-06-25 14:29:54 +02:00
|
|
|
/samples/count:
|
|
|
|
get:
|
|
|
|
summary: total number of samples
|
2020-08-05 18:28:27 +02:00
|
|
|
description: 'Auth: all, levels: read, write, dev, admin'
|
2020-06-25 14:29:54 +02:00
|
|
|
tags:
|
|
|
|
- /sample
|
|
|
|
responses:
|
|
|
|
200:
|
|
|
|
description: sample count
|
|
|
|
content:
|
|
|
|
application/json:
|
|
|
|
schema:
|
|
|
|
properties:
|
|
|
|
count:
|
|
|
|
type: number
|
|
|
|
example: 864
|
|
|
|
500:
|
|
|
|
$ref: 'api.yaml#/components/responses/500'
|
|
|
|
|
2020-04-21 10:53:07 +02:00
|
|
|
/sample/{id}:
|
|
|
|
parameters:
|
2020-04-29 12:10:27 +02:00
|
|
|
- $ref: 'api.yaml#/components/parameters/Id'
|
2020-04-21 10:53:07 +02:00
|
|
|
get:
|
2020-06-18 08:57:50 +02:00
|
|
|
summary: sample details
|
2020-08-05 18:28:27 +02:00
|
|
|
description: 'Auth: all, levels: read, write, dev, admin, spectral data can only be accessed by dev and admin<br>
|
|
|
|
Returns validated as well as new measurements'
|
|
|
|
x-doc: deleted samples are available only for dev/admin
|
2020-04-21 10:53:07 +02:00
|
|
|
tags:
|
|
|
|
- /sample
|
|
|
|
responses:
|
|
|
|
200:
|
|
|
|
description: samples details
|
|
|
|
content:
|
|
|
|
application/json:
|
|
|
|
schema:
|
2020-04-29 12:10:27 +02:00
|
|
|
$ref: 'api.yaml#/components/schemas/SampleDetail'
|
2020-04-21 10:53:07 +02:00
|
|
|
401:
|
2020-04-29 12:10:27 +02:00
|
|
|
$ref: 'api.yaml#/components/responses/401'
|
2020-07-20 16:31:48 +02:00
|
|
|
403:
|
|
|
|
$ref: 'api.yaml#/components/responses/403'
|
2020-04-21 10:53:07 +02:00
|
|
|
404:
|
2020-04-29 12:10:27 +02:00
|
|
|
$ref: 'api.yaml#/components/responses/404'
|
2020-04-21 10:53:07 +02:00
|
|
|
500:
|
2020-04-29 12:10:27 +02:00
|
|
|
$ref: 'api.yaml#/components/responses/500'
|
2020-04-21 10:53:07 +02:00
|
|
|
put:
|
2020-05-07 21:55:29 +02:00
|
|
|
summary: change sample
|
2020-08-05 18:28:27 +02:00
|
|
|
description: 'Auth: basic, levels: write, dev, admin <br>
|
|
|
|
Only dev and admin are allowed to edit samples created by another user'
|
2020-05-28 13:05:00 +02:00
|
|
|
x-doc: status is reset to 0 on any changes, deleted samples cannot be changed
|
2020-04-21 10:53:07 +02:00
|
|
|
tags:
|
|
|
|
- /sample
|
2020-04-23 13:59:45 +02:00
|
|
|
security:
|
|
|
|
- BasicAuth: []
|
2020-04-21 10:53:07 +02:00
|
|
|
requestBody:
|
|
|
|
required: true
|
|
|
|
content:
|
|
|
|
application/json:
|
|
|
|
schema:
|
2020-04-29 12:10:27 +02:00
|
|
|
$ref: 'api.yaml#/components/schemas/Sample'
|
2020-04-21 10:53:07 +02:00
|
|
|
responses:
|
|
|
|
200:
|
|
|
|
description: samples details
|
|
|
|
content:
|
|
|
|
application/json:
|
|
|
|
schema:
|
2020-05-07 21:55:29 +02:00
|
|
|
$ref: 'api.yaml#/components/schemas/SampleRefs'
|
2020-04-21 10:53:07 +02:00
|
|
|
400:
|
2020-04-29 12:10:27 +02:00
|
|
|
$ref: 'api.yaml#/components/responses/400'
|
2020-04-21 10:53:07 +02:00
|
|
|
401:
|
2020-04-29 12:10:27 +02:00
|
|
|
$ref: 'api.yaml#/components/responses/401'
|
2020-04-21 10:53:07 +02:00
|
|
|
403:
|
2020-04-29 12:10:27 +02:00
|
|
|
$ref: 'api.yaml#/components/responses/403'
|
2020-04-21 10:53:07 +02:00
|
|
|
404:
|
2020-04-29 12:10:27 +02:00
|
|
|
$ref: 'api.yaml#/components/responses/404'
|
2020-04-21 10:53:07 +02:00
|
|
|
500:
|
2020-04-29 12:10:27 +02:00
|
|
|
$ref: 'api.yaml#/components/responses/500'
|
2020-04-21 10:53:07 +02:00
|
|
|
delete:
|
2020-05-07 21:55:29 +02:00
|
|
|
summary: delete sample
|
2020-08-05 18:28:27 +02:00
|
|
|
description: 'Auth: basic, levels: write, dev, admin <br>
|
|
|
|
Only dev and admin are allowed to edit samples created by another user'
|
|
|
|
x-doc: sets status to -1, notes and references to this sample are also kept, only note_fields are updated
|
|
|
|
accordingly
|
2020-04-21 10:53:07 +02:00
|
|
|
tags:
|
|
|
|
- /sample
|
2020-04-23 13:59:45 +02:00
|
|
|
security:
|
|
|
|
- BasicAuth: []
|
2020-04-21 10:53:07 +02:00
|
|
|
responses:
|
|
|
|
200:
|
2020-04-29 12:10:27 +02:00
|
|
|
$ref: 'api.yaml#/components/responses/Ok'
|
2020-04-21 10:53:07 +02:00
|
|
|
400:
|
2020-04-29 12:10:27 +02:00
|
|
|
$ref: 'api.yaml#/components/responses/400'
|
2020-04-21 10:53:07 +02:00
|
|
|
401:
|
2020-04-29 12:10:27 +02:00
|
|
|
$ref: 'api.yaml#/components/responses/401'
|
2020-04-21 10:53:07 +02:00
|
|
|
403:
|
2020-04-29 12:10:27 +02:00
|
|
|
$ref: 'api.yaml#/components/responses/403'
|
2020-04-21 10:53:07 +02:00
|
|
|
404:
|
2020-04-29 12:10:27 +02:00
|
|
|
$ref: 'api.yaml#/components/responses/404'
|
2020-07-20 16:31:48 +02:00
|
|
|
500:
|
|
|
|
$ref: 'api.yaml#/components/responses/500'
|
|
|
|
|
|
|
|
/sample/number/{number}:
|
|
|
|
parameters:
|
|
|
|
- $ref: 'api.yaml#/components/parameters/Number'
|
|
|
|
get:
|
|
|
|
summary: sample details
|
2020-08-05 18:28:27 +02:00
|
|
|
description: 'Auth: all, levels: read, write, dev, admin, spectral data can only be accessed by dev and admin<br>
|
|
|
|
Returns validated as well as new measurements'
|
|
|
|
x-doc: deleted samples are available only for dev/admin
|
2020-07-20 16:31:48 +02:00
|
|
|
tags:
|
|
|
|
- /sample
|
|
|
|
responses:
|
|
|
|
200:
|
|
|
|
description: samples details
|
|
|
|
content:
|
|
|
|
application/json:
|
|
|
|
schema:
|
|
|
|
$ref: 'api.yaml#/components/schemas/SampleDetail'
|
|
|
|
401:
|
|
|
|
$ref: 'api.yaml#/components/responses/401'
|
|
|
|
403:
|
|
|
|
$ref: 'api.yaml#/components/responses/403'
|
|
|
|
404:
|
|
|
|
$ref: 'api.yaml#/components/responses/404'
|
2020-04-21 10:53:07 +02:00
|
|
|
500:
|
2020-04-29 12:10:27 +02:00
|
|
|
$ref: 'api.yaml#/components/responses/500'
|
2020-05-06 14:39:04 +02:00
|
|
|
|
2020-05-28 14:41:35 +02:00
|
|
|
/sample/restore/{id}:
|
|
|
|
parameters:
|
|
|
|
- $ref: 'api.yaml#/components/parameters/Id'
|
|
|
|
put:
|
|
|
|
summary: restore sample
|
2020-08-05 18:28:27 +02:00
|
|
|
description: 'Auth: basic, levels: dev, admin'
|
2020-05-28 14:41:35 +02:00
|
|
|
x-doc: status is set to 0
|
|
|
|
tags:
|
|
|
|
- /sample
|
|
|
|
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'
|
|
|
|
|
2020-05-29 12:22:01 +02:00
|
|
|
/sample/validate/{id}:
|
|
|
|
parameters:
|
|
|
|
- $ref: 'api.yaml#/components/parameters/Id'
|
|
|
|
put:
|
|
|
|
summary: set sample status to validated
|
2020-08-05 18:28:27 +02:00
|
|
|
description: 'Auth: basic, levels: dev, admin'
|
2020-05-29 12:22:01 +02:00
|
|
|
x-doc: status is set to 10
|
|
|
|
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'
|
|
|
|
|
2020-05-06 14:39:04 +02:00
|
|
|
/sample/new:
|
|
|
|
post:
|
|
|
|
summary: add sample
|
2020-08-05 18:28:27 +02:00
|
|
|
description: 'Auth: basic, levels: write, dev, admin. Number property is only for admin when adding existing
|
|
|
|
samples'
|
2020-05-13 12:06:28 +02:00
|
|
|
x-doc: 'Adds status: 0 automatically'
|
2020-05-06 14:39:04 +02:00
|
|
|
tags:
|
|
|
|
- /sample
|
|
|
|
security:
|
|
|
|
- BasicAuth: []
|
|
|
|
requestBody:
|
|
|
|
required: true
|
|
|
|
content:
|
|
|
|
application/json:
|
|
|
|
schema:
|
2020-06-02 10:24:22 +02:00
|
|
|
allOf:
|
|
|
|
- $ref: 'api.yaml#/components/schemas/Sample'
|
|
|
|
properties:
|
|
|
|
number:
|
|
|
|
type: string
|
|
|
|
readOnly: false
|
2020-05-06 14:39:04 +02:00
|
|
|
responses:
|
|
|
|
200:
|
|
|
|
description: samples details
|
|
|
|
content:
|
|
|
|
application/json:
|
|
|
|
schema:
|
|
|
|
$ref: 'api.yaml#/components/schemas/SampleRefs'
|
|
|
|
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'
|
|
|
|
|
2020-04-21 10:53:07 +02:00
|
|
|
/sample/notes/fields:
|
|
|
|
get:
|
2020-05-08 09:58:12 +02:00
|
|
|
summary: list all existing field names for custom notes fields
|
2020-08-05 18:28:27 +02:00
|
|
|
description: 'Auth: all, levels: read, write, dev, admin'
|
2020-05-18 14:47:22 +02:00
|
|
|
x-doc: integrity has to be ensured
|
2020-04-21 10:53:07 +02:00
|
|
|
tags:
|
|
|
|
- /sample
|
|
|
|
responses:
|
|
|
|
200:
|
|
|
|
description: field names and quantity of usage
|
|
|
|
content:
|
|
|
|
application/json:
|
|
|
|
schema:
|
2020-06-18 08:57:50 +02:00
|
|
|
type: array
|
|
|
|
items:
|
|
|
|
properties:
|
|
|
|
name:
|
|
|
|
type: string
|
|
|
|
qty:
|
|
|
|
type: number
|
|
|
|
example: 20
|
2020-04-21 10:53:07 +02:00
|
|
|
401:
|
2020-04-29 12:10:27 +02:00
|
|
|
$ref: 'api.yaml#/components/responses/401'
|
2020-04-21 10:53:07 +02:00
|
|
|
500:
|
2020-04-29 12:10:27 +02:00
|
|
|
$ref: 'api.yaml#/components/responses/500'
|