-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathapi.yml
407 lines (407 loc) · 12.8 KB
/
api.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
swagger: '2.0'
info:
title: MSDS Search API
version: 1.0.0
description: >-
MSDS by Adrian Fichtner, Leonard Krause, Salomo Pflugradt, David Reinartz @
Universität Leipzig, 2018
termsOfService: 'http://localhost:8080/terms'
contact:
email: lek@outlook.de
license:
name: License
url: 'http://localhost/licenses'
host: 'localhost:8080'
basePath: /
tags:
- name: Search
description: Main search endpoint
- name: Logging
description: Logging endpoint
- name: Suggestions
description: Retrieve suggested terms for partial search terms
schemes:
- http
paths:
/search:
post:
tags:
- Search
summary: >-
Retrieve search results for a given search term. Supports paging and
sorting.
description: ''
operationId: search
produces:
- application/json
parameters:
- in: body
name: body
description: Log object to be added to the database
required: true
schema:
$ref: '#/definitions/GeneralTerm'
- in: query
name: page
type: string
description: Number of page
required: false
- in: query
name: size
type: string
description: Number of items per page
required: false
responses:
'200':
description: Successful operation
schema:
$ref: '#/definitions/Results'
'400':
description: Page out of range
/advancedSearch:
post:
tags:
- Search
summary: >-
Retrieve search results for a given advanced search term. Supports paging and
sorting.
description: ''
operationId: advancedSearch
produces:
- application/json
parameters:
- in: body
name: body
description: Log object to be added to the database
required: true
schema:
$ref: '#/definitions/AdvancedTerm'
- in: query
name: page
type: string
description: Number of page
required: false
- in: query
name: size
type: string
description: Number of items per page
required: false
responses:
'200':
description: Successful operation
schema:
$ref: '#/definitions/Results'
'400':
description: Page out of range
/suggest:
get:
tags:
- Suggestions
summary: >-
Retrieve autocomplete suggestions for advanced search.
description: ''
operationId: suggest
produces:
- application/json
parameters:
- in: query
name: s
type: string
description: Search term
required: true
- in: query
name: field
type: string
description: Advanced search field (productId, fsc, fscString, fsgString, niin, companyName)
required: true
- in: query
name: count
type: string
description: Number of terms to be returned (defaults to 10)
required: false
responses:
'200':
description: Request successful. Caution, list may be empty.
schema:
$ref: '#/definitions/Suggestions'
/log:
post:
tags:
- Logging
summary: Send logging data here
description: >-
Endpoint for collecting user behaviour data. Everything sent here is
automatically added to the logging database.
operationId: addLog
produces:
- application/json
parameters:
- in: body
name: body
description: Log object to be added to the database
required: true
schema:
$ref: '#/definitions/Log'
responses:
'200':
description: Successful operation
/top:
get:
tags:
- Logging
summary: >-
Retrieve a list of most popular search terms.
description: ''
operationId: topTerms
produces:
- application/json
parameters:
- in: query
name: count
type: string
description: Number of terms to be returned (defaults to 10)
required: false
responses:
'200':
description: Request successful. Caution, list may be empty.
schema:
$ref: '#/definitions/Suggestions'
definitions:
DataSheetDocument:
type: object
description: Values are \"null\" if information is not on MSDS
properties:
score:
type: number
description: Score of the retrieved document in context of given search term
docType:
type: string
description: >-
Marks that object is a datasheet, thus value will always be
"datasheet"
productId:
type: string
description: Product name
fsc:
type: string
description: Federal Supply Class
niin:
type: string
description: National Item Identification Number
companyName:
type: string
description: Name of the responsible party
msdsDate:
type: string
description: MSDS date
ingredients:
type: array
description: Product composition
items:
$ref: '#/definitions/IngredientDocument'
rawIdentification:
type: string
description: Raw text for category "Product Identification"
rawComposition:
type: string
description: Raw text for category "Composition/Information on Ingredients"
rawHazards:
type: string
description: Raw text for category "Hazards Identification"
rawFirstaid:
type: string
description: Raw text for category "First Aid Measures"
rawFireFighting:
type: string
description: Raw text for category "Fire Fighting Measures"
rawAccidentalRelease:
type: string
description: Raw text for category "Accidental Release Measures"
rawHandlingStorage:
type: string
description: Raw text for category "Handling and Storage"
rawProtection:
type: string
description: Raw text for category "Exposure Controls/Personal Protection"
rawChemicalProperties:
type: string
description: Raw text for category "Physical/Chemical Properties"
rawStabilityReactivity:
type: string
description: Raw text for category "Stability and Reactivity Data"
rawDisposal:
type: string
description: Raw text for category "Disposal Considerations"
rawToxic:
type: string
description: Raw text for category "Toxicological Information"
rawEco:
type: string
description: Raw text for category "Ecological Information"
rawTransport:
type: string
description: Raw text for category "MSDS Transport Information"
rawRegulatory:
type: string
description: Raw text for category "Regulatory Information"
rawOther:
type: string
description: Raw text for category "Other Information"
IngredientDocument:
type: object
properties:
docType:
type: string
description: >-
Marks that object is an ingredient, thus value will always be
"ingredient"
ingredName:
type: string
description: Ingredient name
cas:
type: string
description: Chemical Abstracts Service Registry Number
GeneralTerm:
type: object
properties:
searchTerm:
type: string
description: 'Query the user types in'
fsgFacet:
type: string
description: 'Two-digit number. Iff not containing FSG number or "null", results are not filtered and FSG facets are returned. Iff containing FSG number, results are filtered by that FSG number and FSC facets are returned.'
fscFacet:
type: string
description: 'Four-digit number. Iff not containing FSC number or "null", results are not filtered by FSC (may still be filtered by FSG). Iff containing FSC number, results are filtered by that FSC number.'
fuzzy:
type: boolean
description: 'If true, search is fuzzy, not fuzzy otherwise (remember that through tokenization results could still look like search is fuzzy even if it is not).'
default: false
wholeDoc:
type: boolean
description: 'If true, the whole document will be searched instead of just the structured parameters.'
default: false
AdvancedTerm:
type: object
properties:
productId:
type: string
description: 'Name of product to be retrieved'
fscString:
type: string
description: 'FSC category of the result products'
fsgString:
type: string
description: 'FSG category of the result products'
niin:
type: string
description: 'NIIN of the product to be retrieved'
companyName:
type: string
description: 'Company name to search for'
beginDate:
type: string
description: 'Filtering results by date. Must have UTC format (e.g. "1991-01-16T23:00:00Z") with clock at "23:00:00:000Z". Both begin AND end date must be specified for filtering to have an effect.'
endDate:
type: string
description: 'Filtering results by date. Must have UTC format (e.g. "1991-01-16T23:00:00Z") with clock at "23:00:00:000Z". Both begin AND end date must be specified for filtering to have an effect.'
ingredients:
type: array
description: 'List of ingredients to be retrieved. CAS or ingredName may be "null"'
items:
$ref: '#/definitions/AdvancedTermIngredient'
fsgFacet:
type: string
description: 'Two-digit number. Iff not containing FSG number or "null", results are not filtered and FSG facets are returned. Iff containing FSG number, results are filtered by that FSG number and FSC facets are returned. User should be able to enter this himself when using advanced search.'
fscFacet:
type: string
description: 'Four-digit number. Iff not containing FSC number or "null", results are not filtered by FSC (may still be filtered by FSG). Iff containing FSC number, results are filtered by that FSC number. User should be able to enter this himself when using advanced search.'
fuzzy:
type: boolean
description: 'If true, search is fuzzy, not fuzzy otherwise (remember that through tokenization results could still look like search is fuzzy even if it is not).'
default: false
wholeDoc:
type: boolean
description: 'If true, the whole document will be searched instead of just the structured parameters.'
default: false
AdvancedTermIngredient:
type: object
properties:
ingredName:
type: string
description: 'Name of the searched ingredient'
cas:
type: string
description: 'CAS number of the searched ingredient'
Suggestions:
type: object
properties:
suggestions:
type: array
description: 'List of suggested autocompletions'
items:
type: string
TopTerms:
type: object
properties:
suggestions:
type: array
description: 'List of terms most often searched for'
items:
type: string
Meta:
type: object
properties:
totalCount:
type: integer
description: Total number of retrieved documents
pageSize:
type: integer
description: Number of documents per page
count:
type: integer
description: Number of items on the current page
page:
type: integer
description: Current page number
hasNext:
type: boolean
description: '"True" if next page exists, "False" otherwise'
totalPages:
type: integer
description: Total number of pages
Results:
type: object
properties:
items:
type: array
description: List of retrieved datasheets
items:
$ref: '#/definitions/DataSheetDocument'
meta:
$ref: '#/definitions/Meta'
Log:
type: object
properties:
searchTerm:
type: string
description: Search term
timestamp:
type: string
description: Timestamp of the search
ipAddress:
type: string
description: Users IP address
dwellTime:
type: number
description: >-
Amount of time a user spends on a retrieved document. Should be "null"
if user does not return to search page.
resultClicks:
type: integer
description: Number of documents user clicks on
anyResults:
type: boolean
description: >-
"True" if search returns one ore more results, "False" if search
returns no results