-
Notifications
You must be signed in to change notification settings - Fork 5
/
openapi.yaml
560 lines (536 loc) · 15.3 KB
/
openapi.yaml
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
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
swagger: "2.0"
info:
description: "Botfront API"
title: "Botfront API"
consumes:
- "application/json"
produces:
- "application/json"
schemes:
- "https"
paths:
"/project/{project_id}/response/name/{name}/lang/{lang}":
get:
summary: Retrieve a bot response with its name
description: >
A bot response is a sequence of messages in the Botfront format. The JSON example below shows a simple text message but all the Botfront message types (Quick replies, images, Facebook templates, ...) can be returned in that array.
Use the Bot Responses section of the Botfront app for a complete refence ( in `yaml`).
operationId: getBotResponse
parameters:
- name: project_id
in: path
description: Botfront project ID
required: true
type: string
- name: name
in: path
description: Bot response name
required: true
type: string
- name: lang
in: path
description: The bot response language
required: true
type: string
- name: metadata
in: query
description: if metadata is set to 1, the metadata field will be included in the response sequence
required: false
type: integer
responses:
default:
description: Unknown error
400:
description: Bad request
404:
description: Project not found
403:
description: Unauthorized
200:
description: Succesfull response
schema:
$ref: "#/definitions/sequence"
"/project/{project_id}/responses":
get:
operationId: getAllResponses
parameters:
- name: project_id
in: path
description: Botfront project ID
required: true
type: string
- name: timestamp
in: query
description: timestamp in ms of last update
required: false
type: number
- name: metadata
in: query
description: if metadata is set to 1, the metadata field will be included in the response sequence
required: false
type: integer
produces:
- application/json
summary: Retrieve all bot responses. If you pass the `timestamp` query param it will compare it with the last update time of the responses. If they have not been modified, a 304 response is returned. This allows to periodically check for updates
responses:
default:
description: Unknown error
403:
description: Unauthorized
200:
description: OK
schema:
$ref: "#/definitions/bot_responses"
304:
description: Not modified
"/project/{project_id}/response":
post:
operationId: getResponse
parameters:
- name: project_id
in: path
description: Botfront project ID
required: true
type: string
- in: body
name: body
description: NLU information the response should match
schema:
$ref: "#/definitions/matching_criteria"
- name: metadata
in: query
description: if metadata is set to 1, the metadata field will be included in the response sequence
required: false
type: integer
produces:
- application/json
summary: Retrieve a bot response matching NLU criteria
description: >
A bot response is a sequence of messages in the Botfront format. The JSON example below shows a simple text message but all the Botfront message types (Quick replies, images, Facebook templates, ...) can be returned in that array.
Use the Bot Responses section of the Botfront app for a complete refence ( in `yaml`).
Note that if the `language` parameter is ommited, only the `key` will be returned, not the sequence
responses:
default:
description: Unknown error
400:
description: Bad request
404:
description: Project not found
403:
description: Unauthorized
200:
description: OK
schema:
$ref: "#/definitions/bot_response"
# "/project/{project_id}/tracker/{sender_id}/tag/{tag}":
# get:
# summary: Legacy tracker update endpoint.
# operationId: getTracker
# parameters:
# - name: project_id
# in: path
# description: Botfront project ID
# required: true
# type: string
# - name: sender_id
# in: path
# description: Conversation senderId
# required: true
# type: string
# - name: tag
# in: path
# description: "`development` or `production`"
# required: true
# type: string
# responses:
# default:
# description: Unknown error
# 400:
# description: Bad request
# 404:
# description: Project not found
# 403:
# description: Unauthorized
# 200:
# description: Ok
# "/project/{project_id}/conversations/{sender_id}/{event_count}":
# get:
# summary: Gets a tracker with the `event_count` latest events.
# operationId: getConversation
# parameters:
# - name: project_id
# in: path
# description: Botfront project ID
# required: true
# type: string
# - name: sender_id
# in: path
# description: Conversation senderId
# required: true
# type: string
# - name: event_count
# in: path
# description: The number of events to fetch with the tracker
# required: true
# type: string
# responses:
# default:
# description: Unknown error
# 400:
# description: Bad request
# 404:
# description: Project not found
# 403:
# description: Unauthorized
# 200:
# description: Ok
# "/project/{project_id}/conversations/{sender_id}/insert":
# post:
# summary: Creates a new tracker.
# # description: Parse an utterance and returns NLU structured output.
# operationId: insertUpdateTracker
# parameters:
# - name: project_id
# in: path
# description: Botfront project ID
# required: true
# type: string
# - name: sender_id
# in: path
# description: Conversation senderId
# required: true
# type: string
# responses:
# default:
# description: Unknown error
# 400:
# description: Bad request
# 404:
# description: Project not found
# 403:
# description: Unauthorized
# 200:
# description: Ok
# "/project/{project_id}/conversations/{sender_id}/update":
# post:
# summary: Updates conversation tracker.
# # description: Parse an utterance and returns NLU structured output.
# operationId: postUpdateTracker
# parameters:
# - name: project_id
# in: path
# description: Botfront project ID
# required: true
# type: string
# - name: sender_id
# in: path
# description: Conversation senderId
# required: true
# type: string
# responses:
# default:
# description: Unknown error
# 400:
# description: Bad request
# 404:
# description: Project not found
# 403:
# description: Unauthorized
# 200:
# description: Ok
# "/project/{project_id}/rules":
# get:
# summary: Returns CORE rules.
# # description: Parse an utterance and returns NLU structured output.
# operationId: getRules
# parameters:
# - name: project_id
# in: path
# description: Botfront project ID
# required: true
# type: string
# responses:
# default:
# description: Unknown error
# 400:
# description: Bad request
# 404:
# description: Project not found
# 403:
# description: Unauthorized
# 200:
# description: Ok
# "/project/{project_id}/credentials":
# get:
# summary: Returns CORE channels credentials.
# # description: Parse an utterance and returns NLU structured output.
# operationId: getCredentials
# parameters:
# - name: project_id
# in: path
# description: Botfront project ID
# required: true
# type: string
# responses:
# default:
# description: Unknown error
# 400:
# description: Bad request
# 404:
# description: Project not found
# 403:
# description: Unauthorized
# 200:
# description: Ok
# "/project/{project_id}/endpoints":
# get:
# summary: Returns CORE endpoints.
# # description: Parse an utterance and returns NLU structured output.
# operationId: getEndpoints
# parameters:
# - name: project_id
# in: path
# description: Botfront project ID
# required: true
# type: string
# responses:
# default:
# description: Unknown error
# 400:
# description: Bad request
# 404:
# description: Project not found
# 403:
# description: Unauthorized
# 200:
# description: Ok
"/project/{project_id}/models/published":
get:
summary: Returns the list of published NLU models.
# description: Parse an utterance and returns NLU structured output.
operationId: getModelsPublished
parameters:
- name: project_id
in: path
description: Botfront project ID
required: true
type: string
responses:
default:
description: Unknown error
400:
description: Bad request
404:
description: Project not found
403:
description: Unauthorized
200:
description: Ok
"/conversations/{projectId}/environment/{env}/latest-imported-event":
get:
operationId: getLastestImportedEvent,
parameters:
- name: project_id
in: path
description: Botfront project ID
required: true
type: string
- name: env
in: path
description: environement to get latest imported event from, should be one of production, development
required: true
type: string
produces:
- application/json
responses:
default:
description: Unknown error
400:
description: Bad request
schema: { error: <errorMessage> }
401:
description: Unauthorized
200:
description: OK
schema:
$ref: "#/definitions/timestamp"
500:
description: Internal Server Error
"/conversations/{projectId}/environment/{env}":
post:
operationId: importNewConversation,
parameters:
- name: project_id
in: path
description: Botfront project ID
required: true
type: string
- name: env
in: path
description: environement to import to, should be one of production, development
required: true
type: string
- name: conversations
in: body
description: conversations to import
required: true
type: array
schema:
$ref: "#/definitions/conversations"
- name: processNlu
in: body
description: copy parse_data to activity if true
required: true
type: boolean
produces:
- application/json
responses:
default:
description: Unknown error
400:
description: Bad request
summary: the format of the parameters was not correct
401:
description: Unauthorized
206:
description: Partial Content
summary: some parts of the data were not formated correctly and not added, they are returned in the response body
200:
description: OK
500:
description: Internal Server Error
"/api-docs":
get:
summary: API documentation
security: []
# description: Parse an utterance and returns NLU structured output.
operationId: apiDocs
responses:
default:
description: Unknown error
200:
description: Ok
"/api-docs/{file}":
get:
summary: API documentation
parameters:
- name: file
in: path
description: Botfront project ID
required: true
type: string
security: []
# description: Parse an utterance and returns NLU structured output.
operationId: apiDocsDeps
responses:
default:
description: Unknown error
200:
description: Ok
definitions:
matching_criteria:
type: object
properties:
nlu:
type: object
properties:
intent:
type: string
example: greet
entities:
type: array
items:
type: object
properties:
entity:
type: string
example: city
value:
type: string
example: Paris
bot_response:
type: object
properties:
key:
type: string
example: utter_something
follow_up:
type: string
example: utter_something
values:
type: array
items:
$ref: "#/definitions/sequence"
sequence:
description: test
type: array
items:
$ref: "#/definitions/quick_replies"
timestamp:
properties:
timestamp:
type: integer
example: 1550677361363
message:
type: object
properties:
text:
type: string
example: Something
conversations:
definition: array of conversation element from the db
type: array
items:
type: object
bot_responses:
type: object
properties:
timestamp:
type: integer
example: 1550677361363
responses:
type: array
items:
type: object
properties:
key:
type: string
example: utter_something
value:
type: array
items:
type: object
properties:
sequence:
$ref: "#/definitions/sequence"
lang:
type: string
example: "fr"
match:
type: object
$ref: "#/definitions/matching_criteria"
quick_replies:
type: object
properties:
text:
type: string
example: Something
buttons:
type: array
items:
type: object
properties:
title:
type: string
example: "Yes"
payload:
type: string
example: "/basics.yes"
security:
- api_key: []
securityDefinitions:
# This section configures basic authentication with an API key.
api_key:
type: "apiKey"
name: "key"
in: "query"