-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathswagger.json
513 lines (513 loc) · 16.5 KB
/
swagger.json
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
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
{
"basePath": "/",
"paths": {
"/barcode/0.1.0/reader/{jobid}": {
"get": {
"summary": "Job definition and state",
"security": [{"oauth2schema": ["global"]}],
"produces": ["application/json;charset=UTF-8"],
"description": "Get the ReadResult response , job definition and current state. Please note that you can differentiate completion based on http response status",
"operationId": "getJob",
"responses": {
"200": {
"schema": {"$ref": "#/definitions/ReaderResultJobResponse"},
"description": "Read job returned and Job is done or in error"
},
"202": {
"schema": {"$ref": "#/definitions/ReaderJobResponse"},
"description": "Read job returned and Job is still processing"
},
"404": {
"schema": {"$ref": "#/definitions/ErrorResponse"},
"description": "Invalid job id"
}
},
"parameters": [{
"in": "path",
"name": "jobid",
"description": "jobid",
"type": "string",
"required": true
}],
"tags": ["BarcodeReader"],
"consumes": ["application/json"]
},
"delete": {
"summary": "Delete a job manually",
"security": [{"oauth2schema": ["global"]}],
"produces": ["application/json;charset=UTF-8"],
"description": "Delete the Job and all related files",
"operationId": "deleteJob",
"responses": {
"200": {
"schema": {"$ref": "#/definitions/ReaderJobResponse"},
"description": "Job is deleted"
},
"400": {
"schema": {"$ref": "#/definitions/ErrorResponse"},
"description": "Could not delete all parts"
},
"404": {
"schema": {"$ref": "#/definitions/ErrorResponse"},
"description": "Invalid job id"
}
},
"parameters": [{
"in": "path",
"name": "jobid",
"description": "jobid",
"type": "string",
"required": true
}],
"tags": ["BarcodeReader"],
"consumes": ["application/json"]
},
"put": {
"summary": "Submit job for reading",
"security": [{"oauth2schema": ["global"]}],
"produces": ["application/json;charset=UTF-8"],
"description": "Starts the barcode detection of the uploaded files, using the supplied settings associated with the job in the request body. You can only submit the job after a new Job is created with status INPUTS_UPLOADED or resubmit an existing Job with status ERROR. In all cases the jobId in the path must match the jobId in the request",
"operationId": "submitJob",
"responses": {
"200": {
"schema": {"$ref": "#/definitions/ReaderJobResponse"},
"description": "Read job submitted"
},
"400": {
"schema": {"$ref": "#/definitions/ErrorResponse"},
"description": "Resubmitted job not allowed because the job is currently processing or already processed and had status DONE"
},
"404": {
"schema": {"$ref": "#/definitions/ErrorResponse"},
"description": "Invalid job id"
}
},
"parameters": [
{
"in": "path",
"name": "jobid",
"description": "jobid",
"type": "string",
"required": true
},
{
"schema": {"$ref": "#/definitions/ReaderJob"},
"in": "body",
"name": "job",
"description": "jobEntity",
"required": true
}
],
"tags": ["BarcodeReader"],
"consumes": ["application/json;charset=UTF-8"]
}
},
"/barcode/0.1.0/reader": {"post": {
"summary": "Upload the file",
"security": [{"oauth2schema": ["global"]}],
"produces": ["application/json;charset=UTF-8"],
"description": "Upload the image.",
"operationId": "uploadFile",
"responses": {"200": {
"schema": {"$ref": "#/definitions/ReaderJobResponse"},
"description": "File uploaded successfully. Reader job created but not started yet"
}},
"parameters": [{
"in": "formData",
"name": "stream",
"description": "The first image.",
"type": "file",
"required": true
}],
"tags": ["BarcodeReader"],
"consumes": ["multipart/form-data"]
}}
},
"host": "gw.api.cloud.sphereon.com",
"schemes": ["https"],
"securityDefinitions": {"oauth2schema": {
"tokenUrl": "https://gw.api.cloud.sphereon.com/token",
"scopes": {"global": "accessEverything"},
"type": "oauth2",
"flow": "application"
}},
"definitions": {
"ReaderJobSettings": {
"description": "Barcode reader settings",
"type": "object",
"properties": {
"lifecycle": {"$ref": "#/definitions/Lifecycle"},
"outputFileName": {"type": "string"},
"engine": {
"type": "string",
"enum": [
"BASIC",
"ADVANCED",
"PREMIUM"
]
},
"outputFileFormat": {
"type": "string",
"enum": ["JSON"]
}
}
},
"Barcode": {
"type": "object",
"properties": {
"confidenceLevel": {
"format": "double",
"description": "The confidence level of the barcode",
"readOnly": true,
"type": "number"
},
"pageNo": {
"format": "int32",
"description": "The number of the page the barcode is on",
"readOnly": true,
"type": "integer"
},
"coordinates": {
"description": "The coordinates of the barcode. There are usually 2 coordinates, with an x and y value and an anchor.",
"readOnly": true,
"type": "array",
"items": {"$ref": "#/definitions/BarcodeCoordinate"}
},
"text": {
"description": "The text of the barcode",
"readOnly": true,
"type": "string"
},
"type": {
"description": "The type of the barcode",
"readOnly": true,
"type": "string",
"enum": [
"AZTEC",
"CODABAR",
"CODE_39",
"CODE_39_EXTENDED",
"CODE_93",
"CODE_128",
"DATA_MATRIX",
"EAN_8",
"EAN_13",
"ITF",
"MAXICODE",
"PDF_417",
"QR_CODE",
"RSS_14",
"RSS_EXPANDED",
"UPC_A",
"UPC_E",
"UPC_EAN_EXTENSION",
"IDENTCODE",
"INTERLEAVED25"
]
}
}
},
"Lifecycle": {
"description": "Lifecycle settings. When no lifecycle settings are supplied, the job and files will be deleted directly after retrieval of the file",
"type": "object",
"properties": {
"actionTime": {
"format": "date-time",
"description": "The time at which the job and files will be deleted, regardless of whether it has been retrieved or not. Maximal time is 1 day from job creation",
"type": "string"
},
"action": {
"type": "string",
"enum": ["DELETE"]
},
"type": {
"type": "string",
"enum": [
"RETRIEVAL",
"TIME"
]
}
}
},
"Error": {
"description": "An error",
"type": "object",
"required": [
"code",
"level",
"message"
],
"properties": {
"code": {"type": "string"},
"level": {
"type": "string",
"enum": [
"INFO",
"WARNING",
"FATAL"
]
},
"cause": {"$ref": "#/definitions/Error"},
"message": {"type": "string"}
}
},
"ReaderJobResponse": {
"description": "The Reader job response. Has access to the job, it' s settings as well as engine tasks",
"type": "object",
"required": [
"inputs",
"status"
],
"properties": {
"completionTime": {
"format": "date-time",
"description": "The completion date/time of this job in ISO 8601 format",
"readOnly": true,
"type": "string"
},
"jobId": {"type": "string"},
"creationTime": {
"format": "date-time",
"description": "The creation date/time of this job in ISO 8601 format",
"readOnly": true,
"type": "string"
},
"inputs": {
"description": "The original input files. Currently supported inputs are: tif files",
"type": "array",
"items": {"type": "string"}
},
"updateTime": {
"format": "date-time",
"description": "The last update date/time of this job in ISO 8601 format",
"readOnly": true,
"type": "string"
},
"job": {"$ref": "#/definitions/ReaderJob"},
"statusMessage": {
"description": "A status message, which can be informational, warning or error. A message here does not indicate an error perse",
"readOnly": true,
"type": "string"
},
"tasks": {
"description": "The server supplied reader task(s)",
"readOnly": true,
"type": "array",
"items": {"$ref": "#/definitions/ReaderEngineTask"}
},
"queueTime": {
"format": "date-time",
"description": "The reader queue date/time of this job in ISO 8601 format",
"readOnly": true,
"type": "string"
},
"status": {
"description": "The status of the job",
"readOnly": true,
"type": "string",
"enum": [
"INPUTS_UPLOADED",
"PROCESSING",
"DONE",
"ERROR",
"DELETED"
]
}
}
},
"ReaderEngineTask": {
"type": "object",
"properties": {
"jobId": {
"description": "The current job Id",
"readOnly": true,
"type": "string"
},
"queueId": {
"description": "The queue Id provided by a backend system",
"readOnly": true,
"type": "string"
},
"engine": {
"description": "The Engine being used",
"readOnly": true,
"type": "string",
"enum": [
"ADVANCED",
"PREMIUM",
"BASIC"
]
},
"inputs": {
"description": "The names of the supplied files/inputs",
"readOnly": true,
"type": "array",
"items": {"type": "string"}
},
"documentId": {
"description": "The document Id provided by a backend system",
"readOnly": true,
"type": "string"
},
"url": {
"description": "The URL on the bucketstore for the Barcode file. Only available once the status is DONE",
"readOnly": true,
"type": "string"
},
"status": {
"description": "The status of the Reader task itself",
"readOnly": true,
"type": "string",
"enum": [
"REQUESTED",
"QUEUED",
"PROCESSING",
"DONE",
"ERROR"
]
}
}
},
"ReaderResultJobResponse": {
"description": "The Reader job response. Has access to the job, it' s settings as well as engine tasks",
"type": "object",
"required": [
"barcodes",
"inputs",
"status"
],
"properties": {
"completionTime": {
"format": "date-time",
"description": "The completion date/time of this job in ISO 8601 format",
"readOnly": true,
"type": "string"
},
"jobId": {"type": "string"},
"creationTime": {
"format": "date-time",
"description": "The creation date/time of this job in ISO 8601 format",
"readOnly": true,
"type": "string"
},
"inputs": {
"description": "The original input files. Currently supported inputs are: tif files",
"type": "array",
"items": {"type": "string"}
},
"updateTime": {
"format": "date-time",
"description": "The last update date/time of this job in ISO 8601 format",
"readOnly": true,
"type": "string"
},
"barcodes": {
"description": "The returned barcodes",
"readOnly": true,
"type": "array",
"items": {"$ref": "#/definitions/Barcode"}
},
"job": {"$ref": "#/definitions/ReaderJob"},
"statusMessage": {
"description": "A status message, which can be informational, warning or error. A message here does not indicate an error perse",
"readOnly": true,
"type": "string"
},
"tasks": {
"description": "The server supplied reader task(s)",
"readOnly": true,
"type": "array",
"items": {"$ref": "#/definitions/ReaderEngineTask"}
},
"queueTime": {
"format": "date-time",
"description": "The reader queue date/time of this job in ISO 8601 format",
"readOnly": true,
"type": "string"
},
"status": {
"description": "The status of the job",
"readOnly": true,
"type": "string",
"enum": [
"INPUTS_UPLOADED",
"PROCESSING",
"DONE",
"ERROR",
"DELETED"
]
}
}
},
"ReaderJob": {
"description": "The Detector job. Has access to the job settings.",
"type": "object",
"required": ["jobId"],
"properties": {
"jobId": {
"description": "The server generated job jobId. This jobId is checked against the jobId in the request path on every invocation",
"type": "string"
},
"settings": {"$ref": "#/definitions/ReaderJobSettings"}
}
},
"BarcodeCoordinate": {
"type": "object",
"properties": {
"anchor": {
"description": "The anchor to which the positions apply",
"readOnly": true,
"type": "string",
"enum": [
"LEFT_TOP",
"RIGHT_TOP",
"LEFT_BOTTOM",
"RIGHT_BOTTOM",
"CENTER",
"UNKNOWN"
]
},
"x": {
"format": "int32",
"description": "The X position",
"readOnly": true,
"type": "integer"
},
"y": {
"format": "int32",
"description": "The Y position",
"readOnly": true,
"type": "integer"
}
}
},
"ErrorResponse": {
"description": "The error response",
"type": "object",
"properties": {"errors": {
"type": "array",
"items": {"$ref": "#/definitions/Error"}
}}
}
},
"swagger": "2.0",
"info": {
"license": {
"name": "Apache License Version 2.0",
"url": "http://www.apache.org/licenses/LICENSE-2.0"
},
"contact": {
"name": "Sphereon DevOps Team",
"url": "https://sphereon.com",
"email": "[email protected]"
},
"description": "<b>The Barcode Reader API '/reader' reads barcodes from image files and returns the barcode data as JSON files.<\/b>\r\n\r\nThe flow is generally as follows:\r\n1. First upload an image using the /reader POST endpoint. You will get back a job response that contains a job with its associated settings.\r\n2. Start the job from a PUT request to the /reader/{jobid} endpoint, with the Job and Settings JSON as request body. The barcode detection will now start.\r\n3. Check the job status from the /reader/{jobid} GET endpoint until the status has changed to DONE or ERROR. Messaging using a websocket will be available as an alternative in a future version\r\n4. Retrieve the JSON file using the /reader/{jobid}/stream GET endpoint. This will return the JSON file only when the status is DONE. In other cases it will return the Job Response JSON (with http code 202 instead of 200)\r\n\r\n\r\n<b>Interactive testing: <\/b>A web based test console is available in the <a href=\"https://store.sphereon.com\">Sphereon API Store<\/a>",
"termsOfService": "https://sphereon.com",
"title": "Barcode",
"version": "0.1.0"
},
"tags": [{
"name": "BarcodeReader",
"description": "Barcode reader API"
}]
}