This repository has been archived by the owner on Dec 14, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 3
/
product-data-service.yml
378 lines (298 loc) · 9.5 KB
/
product-data-service.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
consumes:
- application/json
produces:
- application/json
schemes:
- http
- https
swagger: '2.0'
info:
description: "Retailers typically refer to inventory based on SKU. This product data service provides the necessary enterprise data to properly\nidentify products in our system to notify Retailers of events that occur. Endpoints are provided for uploading SKU/UPC mapping\ndata along with all associated metadata (ie. size, color, model) into the system. RFID sensed inventory is read from item tags (EPCs)\nwhich then get converted to UPCs.\n\n__Known services this service depends on:__\n\n○ PostgreSQL\n\n○ EdgeX Core Data\n\n###__Configuration file values__\n+ `serviceName` \t\t\t\t - Runtime name of the service\n\n+ `dbHost` \t\t\t\t - hostname of PostgreSQL database\n\n+ `dbUser` \t\t\t\t - username of PostgreSQL database\n\n+ `dbPass` \t\t\t\t - password of PostgreSQL database\n\n+ `dbPort` \t\t\t\t - port of PostgreSQL database\n\n+ `dbName` \t\t\t\t - Name of PostgreSQL database\n\n+ `dbSSLmode` \t\t\t\t - type of security of PostgreSQL database\n\n+ `loggingLevel` \t\t\t\t - Logging level to use: \"info\" (default) or \"debug\" (verbose)\n\n+ `telemetryEndpoint` \t\t\t\t - URL of the telemetry service receiving the metrics from the service\n\n+ `telemetryDataStoreName` \t\t - Name of the data store in the telemetry service to store the metrics\n\n+ `port` \t\t\t\t\t\t - Port to run the service/s HTTP Server on\n\n+ `responseLimit` \t\t\t\t - Default limit to what can be returned in a GET call - because of this, client must define their own top-skip functionality\n\nCopyright 2019 Intel® Corporation, All rights reserved."
title: Product Data API.
version: 1.0.0
host: 'product-data:8080'
basePath: /
paths:
/:
get:
description: >-
Endpoint that is used to determine if the application is ready to take
web requests
consumes:
- application/json
produces:
- application/json
schemes:
- http
tags:
- default
summary: Healthcheck Endpoint
operationId: Healthcheck
responses:
'200':
description: OK
'/productid/{productId}':
get:
description: |-
This API call is used to get the metadata for a upc.<br><br>
Example query:
<blockquote>/productid/12345678978345</blockquote> <br><br>
Example Result: <br><br>
```json
{
"metadata": {
"color": "blue",
"size": "XS"
},
"productId": "12345678978345"
}
```
consumes:
- application/json
produces:
- application/json
schemes:
- http
tags:
- productid
summary: Retrieves SKU Data
operationId: productids
parameters:
- type: string
x-go-name: ProductID
description: a product id
name: productId
in: path
required: true
responses:
'200':
description: resultsResponse
schema:
$ref: '#/definitions/resultsResponse'
'400':
$ref: '#/responses/schemaValidation'
'404':
$ref: '#/responses/NotFound'
'500':
$ref: '#/responses/internalError'
/skus:
get:
description: >-
This API call is used to retrieve a list of SKU items.
<blockquote>• <b>Search by sku</b>: To search by sku, you would use the
filter query parameter like so: /sku?$filter=(sku eq
'MS122-32')</blockquote>
<blockquote>• <b>Search by name</b>: To search by name, you would use
the filter query parameter like so: /location?$filter=(name eq 'mens
khaki slacks')</blockquote>
`/skus?$top=10&$select=sku` - Useful for paging data. Grab the top 10
records and only pull back the sku field
`/skus?$count` - Tell me how many records are in the database
`/skus?$filter=(sku eq '12345678') and (productList.metadata.color eq
'red')` - This filters on particular sku and UPCs that are classified as
"Red"
`/skus?$orderby=sku desc` - Give me back all skus in descending order by
sku
`/skus?$filter=startswith(sku,'m')` - Give me all skus that begin with
the letter 'm'
`/skus?$count&$filter=(sku eq '12345678')` - Give me the count of items
with the SKU `12345678``
`/skus?$inlinecount=allpages&$filter=(sku eq '12345678')` - Give me all
items with the SKU `12345678` and include how many there are
Example Result:<br><br>
```json
{
"results": [
{
"sku": "12345679",
"productList": [
{
"metadata": {
"color": "blue",
"size": "XS"
},
"productId": "123456789783"
},
{
"metadata": {
"color": "red",
"size": "M"
},
"productId": "123456789784"
}
]
}
]
}
```
consumes:
- application/json
produces:
- application/json
schemes:
- http
tags:
- skus
summary: Retrieves SKU Data
operationId: getSkus
responses:
'200':
description: resultsResponse
schema:
$ref: '#/definitions/resultsResponse'
'400':
$ref: '#/responses/schemaValidation'
'500':
$ref: '#/responses/internalError'
post:
description: >-
This API call is used to upload a list of SKU items into Responsive
Retail.<br>
The SKU data includes:
<blockquote>• <b>SKU</b>: The SKU number, a unique identifier for the
SKU.</blockquote>
<blockquote>• <b>product List</b>: A list (array) of UPCs that are
included in the SKU.</blockquote>
Expected formatting of JSON input (as an example):<br><br>
```json
{
"data":[{
"sku" : "MS122-32",
"productList" : [
{ "productId": "00888446671444", "metadata": {"color":"blue"} },
{ "productId": "889319762751", "metadata": {"size":"small"} }
]
},
{
"sku" : "MS122-34",
"productList" : [
{"productId": "90388987132758", "metadata": {"name":"pants"} }
]
}]
}
```
<br>
Each SKU item is treated individually; it succeeds or fails independent
of the other SKUs.
Check the returned results to determine the success or failure of each
SKU.
consumes:
- application/json
produces:
- application/json
schemes:
- http
tags:
- skus
summary: Loads SKU Data
operationId: postSkus
parameters:
- x-go-name: Data
name: data
in: body
schema:
type: array
items:
$ref: '#/definitions/ProdData'
responses:
'201':
$ref: '#/responses/Created'
'400':
$ref: '#/responses/schemaValidation'
'500':
$ref: '#/responses/internalError'
definitions:
ErrReport:
description: ErrReport is used to wrap schema validation errors int json object
type: object
properties:
description:
type: string
x-go-name: Description
errortype:
type: string
x-go-name: ErrorType
field:
type: string
x-go-name: Field
value:
type: object
x-go-name: Value
ErrorList:
description: ErrorList provides a collection of errors for processing
type: object
properties:
errors:
description: |-
The error list
in: body
type: array
items:
$ref: '#/definitions/ErrReport'
x-go-name: Errors
ProdData:
description: ProdData represents the product data schema in the database
type: object
properties:
productList:
type: array
items:
$ref: '#/definitions/ProductMetadata'
x-go-name: ProductList
sku:
type: string
x-go-name: Sku
ProductMetadata:
description: UpcMetadata represents the productList schema attribute in the database
type: object
properties:
becomingReadable:
type: number
format: double
x-go-name: BecomingReadable
beingRead:
type: number
format: double
x-go-name: BeingRead
dailyTurn:
type: number
format: double
x-go-name: DailyTurn
exitError:
type: number
format: double
x-go-name: ExitError
metadata:
type: object
additionalProperties:
type: object
x-go-name: Metadata
productId:
type: string
x-go-name: ProductID
resultsResponse:
description: 'Response wraps results, inlinecount, and extra fields in a json object'
type: object
properties:
count:
type: integer
format: int64
x-go-name: Count
results:
description: Array containing results of query
type: object
x-go-name: Results
x-go-name: Response
responses:
Created:
description: Created
NotFound:
description: NotFound
internalError:
description: JSONError is the response for errors that occur within the API.
schemaValidation:
description: ErrorList provides a collection of errors for processing
schema:
type: array
items:
$ref: '#/definitions/ErrReport'