Skip to content

Commit f4b65ae

Browse files
committed
Added emailApi.yaml
1 parent 9c26b73 commit f4b65ae

File tree

1 file changed

+293
-0
lines changed

1 file changed

+293
-0
lines changed

Backend/api/emailApi.yaml

Lines changed: 293 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,293 @@
1+
swagger: '2.0'
2+
info:
3+
title: Email Sending API
4+
description: Topcoder internal project hybrid mobile app build pack. There are no specicial configuration variables expected to be on the backend (insecure to be sent from the front-end). Configuration will only contain typical variables for email sending like host.
5+
version: "1.0.0"
6+
# the sample made up domain of the service
7+
host: test.api.topcoder.com
8+
# array of all schemes the API supports
9+
schemes:
10+
- https
11+
securityDefinitions:
12+
Bearer:
13+
type: apiKey
14+
name: Authorization
15+
in: header
16+
# will be prefixed to all paths
17+
basePath: /api/v1
18+
produces:
19+
- application/json
20+
paths:
21+
/emails:
22+
post:
23+
summary: send email
24+
description: This endpoint is responsible for sending an email. If email's delivery time is not specified or in the past, the email is sent immediately. Otherwise it is scheduled to be sent on the given time.
25+
security:
26+
- Bearer: []
27+
parameters:
28+
- name: email
29+
in: body
30+
description: The email to send
31+
required: true
32+
schema:
33+
$ref: '#/definitions/Email'
34+
tags:
35+
- Emails
36+
responses:
37+
200:
38+
description: The response containing id of the created/send email
39+
schema:
40+
type: array
41+
items:
42+
$ref: '#/definitions/Response'
43+
400:
44+
description: Bad Request - if there was problem with the request (e.g. malformed or some parameters are missing)
45+
schema:
46+
$ref: '#/definitions/Error'
47+
401:
48+
description: Not Aauthorized - if the request didn't bear authentication information or the authentication information is invalid.
49+
schema:
50+
$ref: '#/definitions/Error'
51+
403:
52+
description: Forbidden - if the requesting user didn't have permission to perform the requested operation
53+
schema:
54+
$ref: '#/definitions/Error'
55+
500:
56+
description: Internal server error - if the request was properly formatted, but the operation failed on the server side
57+
schema:
58+
$ref: '#/definitions/Error'
59+
default:
60+
description: Unexpected error.
61+
schema:
62+
$ref: '#/definitions/Error'
63+
/emails/{id}:
64+
get:
65+
summary: get email by id
66+
description: This endpoint is responsible for getting an email.
67+
security:
68+
- Bearer: []
69+
parameters:
70+
- name: id
71+
in: path
72+
description: The email id
73+
required: true
74+
type: integer
75+
format: int64
76+
tags:
77+
- Emails
78+
responses:
79+
200:
80+
description: The response containing an email
81+
schema:
82+
$ref: '#/definitions/Email'
83+
400:
84+
description: Bad Request - if there was problem with the request (e.g. malformed or some parameters are missing)
85+
schema:
86+
$ref: '#/definitions/Error'
87+
401:
88+
description: Not Aauthorized - if the request didn't bear authentication information or the authentication information is invalid.
89+
schema:
90+
$ref: '#/definitions/Error'
91+
403:
92+
description: Forbidden - if the requesting user didn't have permission to perform the requested operation
93+
schema:
94+
$ref: '#/definitions/Error'
95+
500:
96+
description: Internal server error - if the request was properly formatted, but the operation failed on the server side
97+
schema:
98+
$ref: '#/definitions/Error'
99+
default:
100+
description: Unexpected error.
101+
schema:
102+
$ref: '#/definitions/Error'
103+
delete:
104+
summary: delete email by id
105+
description: This endpoint is responsible for deleting an email.
106+
security:
107+
- Bearer: []
108+
parameters:
109+
- name: id
110+
in: path
111+
description: The email id
112+
required: true
113+
type: integer
114+
format: int64
115+
tags:
116+
- Emails
117+
responses:
118+
200:
119+
description: The response containing an id of the deleted email
120+
schema:
121+
$ref: '#/definitions/Response'
122+
400:
123+
description: Bad Request - if there was problem with the request (e.g. malformed or some parameters are missing)
124+
schema:
125+
$ref: '#/definitions/Error'
126+
401:
127+
description: Not Aauthorized - if the request didn't bear authentication information or the authentication information is invalid.
128+
schema:
129+
$ref: '#/definitions/Error'
130+
403:
131+
description: Forbidden - if the requesting user didn't have permission to perform the requested operation
132+
schema:
133+
$ref: '#/definitions/Error'
134+
500:
135+
description: Internal server error - if the request was properly formatted, but the operation failed on the server side
136+
schema:
137+
$ref: '#/definitions/Error'
138+
default:
139+
description: Unexpected error.
140+
schema:
141+
$ref: '#/definitions/Error'
142+
143+
/emails/{id}/deliveryStatus:
144+
get:
145+
summary: get the email delivery status
146+
description: This endpoint is responsible for getting an email delivery status.
147+
security:
148+
- Bearer: []
149+
parameters:
150+
- name: id
151+
in: path
152+
description: The email id
153+
required: true
154+
type: integer
155+
format: int64
156+
tags:
157+
- Emails
158+
responses:
159+
200:
160+
description: The response containing the delivery status
161+
schema:
162+
$ref: '#/definitions/DeliveryStatus'
163+
400:
164+
description: Bad Request - if there was problem with the request (e.g. malformed or some parameters are missing)
165+
schema:
166+
$ref: '#/definitions/Error'
167+
401:
168+
description: Not Aauthorized - if the request didn't bear authentication information or the authentication information is invalid.
169+
schema:
170+
$ref: '#/definitions/Error'
171+
403:
172+
description: Forbidden - if the requesting user didn't have permission to perform the requested operation
173+
schema:
174+
$ref: '#/definitions/Error'
175+
500:
176+
description: Internal server error - if the request was properly formatted, but the operation failed on the server side
177+
schema:
178+
$ref: '#/definitions/Error'
179+
default:
180+
description: Unexpected error.
181+
schema:
182+
$ref: '#/definitions/Error'
183+
definitions:
184+
Email:
185+
type: object
186+
properties:
187+
sender:
188+
type: string
189+
description: The sender of the email
190+
recipients:
191+
type: array
192+
items:
193+
type: string
194+
description: The recipients of the email
195+
cc_recipients:
196+
type: array
197+
items:
198+
type: string
199+
description: The CC recipients of the email
200+
bcc_recipients:
201+
type: array
202+
items:
203+
type: string
204+
description: The BCC recipients of the email
205+
subject:
206+
type: string
207+
description: The email subject.
208+
html_body:
209+
type: string
210+
description: The full HTML body of the mail.
211+
text_body:
212+
type: string
213+
description: The optional text body of the mail.
214+
attachments:
215+
type: array
216+
items:
217+
$ref: '#/definitions/Attachment'
218+
images:
219+
type: array
220+
items:
221+
$ref: '#/definitions/Image'
222+
headers:
223+
type: array
224+
items:
225+
type: string
226+
description: The optional extra headers to add to the email
227+
delivery_time:
228+
type: string
229+
format: date
230+
description: The delivery time of the email. When email is sending if it is not specified or in the past, the email is sent immediately. Otherwise it is scheduled to be sent.
231+
Attachment:
232+
type: object
233+
properties:
234+
file_name:
235+
type: string
236+
description: The file name.
237+
file_type:
238+
type: string
239+
description: The MIME type.
240+
content_bytes:
241+
type: string
242+
description: The bytes content of the attachment.
243+
Image:
244+
type: object
245+
properties:
246+
name:
247+
type: string
248+
description: The image name to reference from HTML content.
249+
type:
250+
type: string
251+
description: The image MIME type.
252+
content_bytes:
253+
type: string
254+
description: The bytes content of the image.
255+
Response:
256+
required:
257+
- id
258+
properties:
259+
id:
260+
type: integer
261+
format: int64
262+
description: The id that was created for a new object. Otherwise the id of the affected object
263+
result:
264+
properties:
265+
success:
266+
type: boolean
267+
description: Was the request a success
268+
code:
269+
type: integer
270+
format: int32
271+
description: The http status code
272+
DeliveryStatus:
273+
required:
274+
- delivered
275+
properties:
276+
delivered:
277+
type: boolean
278+
description: The flag indicating if email was delivered.
279+
delivery_time:
280+
type: string
281+
format: date
282+
description: The delivery time.
283+
Error:
284+
type: object
285+
properties:
286+
code:
287+
type: integer
288+
format: int32
289+
message:
290+
type: string
291+
fields:
292+
type: string
293+

0 commit comments

Comments
 (0)