-
Notifications
You must be signed in to change notification settings - Fork 1
/
topsort-catalog-service.yml
488 lines (451 loc) · 14 KB
/
topsort-catalog-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
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
openapi: 3.0.1
info:
title: Topsort Reference Catalog API
contact:
email: [email protected]
license:
name: Apache 2.0
url: http://www.apache.org/licenses/LICENSE-2.0.html
version: 1.0.0
x-logo:
url: https://assets.topsort.com/Topsort_logo_icon_dark.svg
backgroundColor: '#fff'
altText: Topsort
description: Integration for Marketplaces' catalog queries
servers:
- url: https://{marketplaceDomain}
variables:
marketplaceDomain:
default: demo.topsort.com/topsort/api
description: A URL that points to your catalog service
tags:
- name: Catalog
description: Integration for Marketplaces' catalog queries.
- name: Models
x-displayName: All Models
description: |
## Brand
<SchemaDefinition schemaRef="#/components/schemas/Brand" />
## Category
<SchemaDefinition schemaRef="#/components/schemas/Category" />
## GetProductsByID Request
<SchemaDefinition schemaRef="#/components/schemas/GetProductsByIDRequest" />
## GetProductsByID Response
<SchemaDefinition schemaRef="#/components/schemas/GetProductsByIDResponse" />
## Paginated Brands Response
<SchemaDefinition schemaRef="#/components/schemas/PaginatedBrandsResponse" />
## Paginated Categories Response
<SchemaDefinition schemaRef="#/components/schemas/PaginatedCategoriesResponse" />
## Paginated Products Response
<SchemaDefinition schemaRef="#/components/schemas/PaginatedProductsResponse" />
## Paginated Response
<SchemaDefinition schemaRef="#/components/schemas/PaginatedResponse" />
## Paginated Vendors Response
<SchemaDefinition schemaRef="#/components/schemas/PaginatedVendorsResponse" />
## Product
<SchemaDefinition schemaRef="#/components/schemas/Product" />
## Vendor
<SchemaDefinition schemaRef="#/components/schemas/Vendor" />
security:
- BearerAuth: []
paths:
/:
get:
tags:
- Catalog
operationId: healthCheck
security: [] # No security
summary: Health Check
responses:
200:
description: The service is up and ready to accept requests.
/products:
post:
tags:
- Catalog
summary: Retrieves products by IDs
operationId: getProductsByID
requestBody:
description: An array of product IDs.
content:
application/json:
schema:
$ref: '#/components/schemas/GetProductsByIDRequest'
required: true
responses:
200:
description: Returns the products' details, if available.
content:
application/json:
schema:
$ref: '#/components/schemas/GetProductsByIDResponse'
401:
$ref: '#/components/responses/UnauthorizedError'
/products/search:
get:
tags:
- Catalog
summary: Searches products
operationId: searchProducts
parameters:
- in: query
name: search
schema:
type: string
example: delirium tremens
description: >
The search string provided by the user. When a blank string is provided,
the string should match all products (e.g. all products with a given category ID).
required: true
- in: query
name: vendorID
schema:
type: string
minLength: 1
example: '9SiwYqqL8vdG'
description: >
Vendor unique identifier. This identifier is given by the marketplace and allows this service
to match the vendor with the proper products.
required: false
- in: query
name: categoryID
schema:
type: string
minLength: 1
example: ahEDqV5uhjj8
description: Only retrieve products whose category matches the provided ID.
- $ref: '#/components/parameters/nextParam'
responses:
200:
description: Returns products' details for the provided search terms if available, separated in pages.
content:
application/json:
schema:
$ref: '#/components/schemas/PaginatedProductsResponse'
401:
$ref: '#/components/responses/UnauthorizedError'
/categories:
get:
tags:
- Catalog
summary: Retrieves categories
operationId: getCategories
parameters:
- $ref: '#/components/parameters/nextParam'
responses:
200:
description: Returns a complete list of categories, separated in pages.
content:
application/json:
schema:
$ref: '#/components/schemas/PaginatedCategoriesResponse'
401:
$ref: '#/components/responses/UnauthorizedError'
/vendors:
get:
tags:
- Catalog
summary: Retrieves vendors
operationId: getVendors
parameters:
- $ref: '#/components/parameters/nextParam'
responses:
200:
description: Returns a complete list of vendors, separated in pages.
content:
application/json:
schema:
$ref: '#/components/schemas/PaginatedVendorsResponse'
401:
$ref: '#/components/responses/UnauthorizedError'
/brands:
get:
tags:
- Catalog
summary: Retrieves brands
description: >
This endpoint is optional. It is used to allow advanced use cases for Banner Ads. Talk to
your Account Manager to understand whether you need to implement this endpoint.
operationId: getBrands
parameters:
- in: query
name: search
schema:
type: string
example: delirium tremens
description: >
The search string provided by the user. In case this parameter is missing or an empty
string is provided, all brands should be returned taking into account the other
parameters.
required: false
- in: query
name: vendorID
schema:
type: string
minLength: 1
example: '9SiwYqqL8vdG'
description: >
Vendor unique identifier. This identifier is given by the marketplace and allows this
service to match the vendor with the proper brands.
required: false
- $ref: '#/components/parameters/nextParam'
responses:
200:
description: Returns a complete list of brands, separated in pages.
content:
application/json:
schema:
$ref: '#/components/schemas/PaginatedBrandsResponse'
401:
$ref: '#/components/responses/UnauthorizedError'
components:
responses:
UnauthorizedError:
description: Credentials are missing or invalid.
schemas:
GetProductsByIDRequest:
type: array
items:
type: string
minLength: 1
minItems: 0
maxItems: 50
example:
- eyGqR4YQgBJa
- KHqzavLNS25n
- wJLZ4TCNZtEW
GetProductsByIDResponse:
type: array
items:
$ref: '#/components/schemas/Product'
minItems: 0
maxItems: 50
PaginatedResponse:
type: object
properties:
next:
description: >
Id of the next page. This could be for example a page number (as a string) or a cursor
identifying the next page. This attribute will be passed in the `next` query parameter.
type: string
minLength: 1
example: asTpl1k746
Product:
type: object
description: A Product represents a product listed in a marketplace.
properties:
id:
description: The product ID.
type: string
minLength: 1
example: eyGqR4YQgBJa
readOnly: true
name:
description: The product name.
type: string
minLength: 1
example: Delirium Tremens Beer Bottle 330cc x6
description:
description: The product description.
type: string
minLength: 1
example: Named as \"Best Beer in the World\" in 2008 at the World Beer Championships in Chicago, Illinois.
vendorID:
description: The vendor ID.
type: string
minLength: 1
example: 9SiwYqqL8vdG
vendorName:
description: The vendor name.
type: string
minLength: 1
example: Huyghe Brewery
stock:
description: How many items of this product you have available. If this number is greater than 0, it means you have it in stock and you can fulfill a purchase.
type: integer
format: int32
minimum: 0
example: 126
price:
description: The product price in the minimum currency unit (e.g. cents if applicable). Refer to [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) to check how many decimals are used in your currency.
type: integer
format: int32
minimum: 1
example: 14900
imageURL:
description: The product image URL. Its size should be between 250x250 and 600x600 pixels.
type: string
format: uri
example: https://r.btcdn.co/r/eyJzaG9wX2lkIjozMzU4LCJnIjoiMjYweCJ9/1759e16e6314a24/669830-Cerveza_Delirium_Tremens_Botella_330cc_x6.png
categoryID:
description: The category id.
type: string
minLength: 1
example: ahEDqV5uhjj8
categoryName:
description: The category name.
type: string
minLength: 1
example: Beers/Belgian
required:
- id
- name
ProductsResponse:
type: object
required:
- response
properties:
response:
type: array
items:
$ref: '#/components/schemas/Product'
minItems: 0
maxItems: 50
PaginatedProductsResponse:
allOf:
- $ref: '#/components/schemas/PaginatedResponse'
- $ref: '#/components/schemas/ProductsResponse'
Category:
type: object
properties:
id:
description: >
The category ID. If there is no ID for categories in the marketplace, this
can be the category name as long as it is unique.
type: string
minLength: 1
example: ahEDqV5uhjj8
name:
description: The category name.
type: string
minLength: 1
example: Beers/Belgian
required:
- id
- name
CategoriesResponse:
type: object
required:
- response
properties:
response:
type: array
items:
$ref: '#/components/schemas/Category'
minItems: 0
maxItems: 50
example:
- id: ahEDqV5uhjj8
name: Beers/Belgian
- id: cJfoUUzG6GOy
name: Beers/Ales/Amber
- id: oTcnv0fJCRiL
name: Beers/Lagers/Bocks
- id: JspphvZBzV09
name: Beers/Lagers/Blonde
PaginatedCategoriesResponse:
allOf:
- $ref: '#/components/schemas/PaginatedResponse'
- $ref: '#/components/schemas/CategoriesResponse'
Vendor:
type: object
properties:
id:
description: The vendor ID.
type: string
minLength: 1
example: 9SiwYqqL8vdG
name:
description: The vendor name.
type: string
minLength: 1
example: Huyghe Brewery
required:
- id
- name
VendorsResponse:
type: object
required:
- response
properties:
response:
type: array
items:
$ref: '#/components/schemas/Vendor'
minItems: 0
maxItems: 50
example:
- id: C0n7J6j0WySR
name: Black Neck Brewery
- id: y7v6kSGGUUFn
name: Brewery Chile SA
- id: vhvg6ioBj5fk
name: Coda Brewery
- id: IMwMGVfSsEpQ
name: Kunstmann Brewery
- id: zo8UXchnFWZu
name: United Brewery
- id: 9SiwYqqL8vdG
name: Huyghe Brewery
PaginatedVendorsResponse:
allOf:
- $ref: '#/components/schemas/PaginatedResponse'
- $ref: '#/components/schemas/VendorsResponse'
Brand:
type: object
properties:
id:
description: The brand ID.
type: string
minLength: 1
example: 9SiwYqqL8vdG
name:
description: The brand name.
type: string
minLength: 1
example: Pepsi
imageURL:
description: The brand image URL. Its size should be between 250x250 and 600x600 pixels.
type: string
format: uri
required:
- id
- name
BrandsResponse:
type: object
required:
- response
properties:
response:
type: array
items:
$ref: '#/components/schemas/Brand'
minItems: 0
maxItems: 50
example:
- id: bC0n7J6j0WySR
name: Black Neck Brewery
imageURL: https://cdn.marketplace.com/bnb.png
- id: by7v6kSGGUUFn
name: Brewery Chile
imageURL: https://cdn.marketplace.com/bc.png
PaginatedBrandsResponse:
allOf:
- $ref: '#/components/schemas/PaginatedResponse'
- $ref: '#/components/schemas/BrandsResponse'
securitySchemes:
BearerAuth:
type: http
scheme: bearer
parameters:
nextParam:
in: query
name: next
schema:
type: string
minLength: 1
description: >
The string identifying the requested page. In case this parameter is missing then the first
page should be returned. Note that the specifics about this parameter controlled entirely by
what's returned as `next` in a paginated response and could either be a page number or a
cursor.