Skip to content

Commit 312850e

Browse files
authored
feat: add Recommend API spec
0 parents commit 312850e

File tree

1 file changed

+103
-0
lines changed

1 file changed

+103
-0
lines changed

spec.yml

Lines changed: 103 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,103 @@
1+
openapi: 3.0.0
2+
info:
3+
title: Recommend API
4+
description: API powering the Recommend feature of Algolia.
5+
version: 0.1.0
6+
servers:
7+
- url: https://{appid}-1.algolianet.com
8+
- url: https://{appid}-2.algolianet.com
9+
- url: https://{appid}-3.algolianet.com
10+
- url: https://{appid}-dsn.algolianet.com
11+
paths:
12+
/1/indexes/*/recommendations:
13+
post:
14+
operationId: getRecommendations
15+
summary: Get recommendations for the given requests.
16+
parameters:
17+
- in: header
18+
name: X-Algolia-Application-Id
19+
description: Algolia appID
20+
schema:
21+
type: string
22+
- in: header
23+
name: X-Algolia-API-Key
24+
description: Algolia API key
25+
schema:
26+
type: string
27+
requestBody:
28+
required: true
29+
content:
30+
application/json:
31+
schema:
32+
type: array
33+
items:
34+
type: object
35+
properties:
36+
indexName:
37+
type: string
38+
example: products
39+
model:
40+
type: string
41+
enum: [related-products, bought-together]
42+
objectID:
43+
type: string
44+
threshold:
45+
type: number
46+
default: 0
47+
minimum: 0
48+
maximum: 1
49+
maxRecommendations:
50+
type: number
51+
default: 0
52+
example: 5
53+
minimum: 0
54+
maximum: 1000
55+
queryParameters:
56+
type: object
57+
additionalProperties: true
58+
description: A key-value mapping of additional search parameters
59+
example:
60+
filters: "in_stock:true"
61+
fallbackParameters:
62+
type: object
63+
additionalProperties: true
64+
description: A key-value mapping of additional search parameters
65+
example:
66+
filters: "brand:apple"
67+
required:
68+
- indexName
69+
- model
70+
- objectID
71+
responses:
72+
'200':
73+
description: OK
74+
content:
75+
application/json:
76+
schema:
77+
type: object
78+
properties:
79+
results:
80+
type: array
81+
items:
82+
type: object
83+
properties:
84+
hits:
85+
type: array
86+
items:
87+
type: object
88+
additionalProperties: {}
89+
properties:
90+
objectID:
91+
type: string
92+
example: objectID1
93+
_score:
94+
type: number
95+
minimum: 0
96+
maximum: 1
97+
example: 0.41
98+
nbHits:
99+
type: integer
100+
queryID:
101+
type: string
102+
pattern: '[a-f0-9]{32}'
103+
example: 43b15df305339e827f0ac0bdc5ebcaa7

0 commit comments

Comments
 (0)