-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathswagger.yaml
98 lines (98 loc) · 2.76 KB
/
swagger.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
swagger: '2.0'
info:
title: IBM Cognitive Fun Challenge Translate API
description: |
This is the REST API for IBM Cognitive Translate Challenge.
version: "1.0.0"
# the domain of the service
host: bluemix.net
# array of all schemes that your API supports
schemes:
- https
# will be prefixed to all paths
basePath: /api/v1
produces:
- application/json
paths:
/translate:
get:
summary: Translate a String
description: This method will translate a string into another language and calculate the tone of the translation
parameters:
- name: sourceText
in: query
description: Input String to translate.
required: true
type: string
- name: sourceLanguageCode
in: query
description: Source Language to Translate From.
required: true
type: string
- name: destinationLanguageCode
in: query
description: Target Language to Translate To.
required: true
type: string
responses:
200:
description: Completed Translation Object
schema:
$ref: '#/definitions/Translation'
400:
description: The input is not valid
schema:
$ref: '#/definitions/Error'
default:
description: Unexpected error
schema:
$ref: '#/definitions/Error'
/history:
get:
summary: Get History from DB
description: Get translation history from the database. Should return n entries sorted by date descending (most recent, first)
parameters:
- name: num
in: query
default: 5
description: Number of Translations to return
required: false
type: integer
responses:
200:
description: Return array of translation
schema:
type: array
items:
$ref: '#/definitions/Translation'
definitions:
Translation:
properties:
sourceText:
type: string
description: Input String to Translate
sourceLanguageCode:
type: string
description: Language to Translate From
destinationLanguageCode:
type: string
description: Target Language to Translate To
sourceTextTone:
type: string
format: json
description: Tone Object returned by Watson
translatedText:
type: string
description: Text Translation by Watson
translatedTextTone:
type: string
format: json
description: Tone Object returned by Watson
Error:
properties:
code:
type: string
description: The error code that refers the error type.
message:
type: string
description: The error message.