-
Notifications
You must be signed in to change notification settings - Fork 5.2k
/
Copy pathCommunicationServicesEmail.json
384 lines (384 loc) · 12.2 KB
/
CommunicationServicesEmail.json
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
{
"swagger": "2.0",
"info": {
"title": "EmailClient",
"description": "Azure Communication Email Service",
"version": "2023-01-15-preview"
},
"paths": {
"/emails/operations/{operationId}": {
"get": {
"tags": [
"EmailGetSendResult"
],
"summary": "Gets the status of the email send operation.",
"operationId": "Email_GetSendResult",
"produces": [
"application/json"
],
"parameters": [
{
"in": "path",
"name": "operationId",
"description": "ID of the long running operation (GUID) returned from a previous call to send email",
"required": true,
"type": "string"
},
{
"$ref": "#/parameters/ApiVersionParameter"
}
],
"responses": {
"default": {
"description": "Error",
"headers": {
"x-ms-error-code": {
"description": "Error code - this will be the same as the code in the error property in the response body.",
"type": "string"
}
},
"schema": {
"$ref": "../../../../../common-types/data-plane/v1/types.json#/definitions/ErrorResponse"
}
},
"200": {
"description": "Message status was successfully retrieved.",
"headers": {
"retry-after": {
"description": "This header will only be present when the status is a non-terminal status. It indicates the minimum amount of time in seconds to wait before polling for operation status again.",
"type": "integer",
"format": "int32"
}
},
"schema": {
"$ref": "#/definitions/EmailSendResult"
}
}
},
"x-ms-examples": {
"Get Message Status FailedTerminalStatus": {
"$ref": "./examples/GetOperationStatusReturnsFailedTerminalStatus.json"
},
"Get Message Status NonTerminalStatus": {
"$ref": "./examples/GetOperationStatusReturnsNonTerminalStatus.json"
},
"Get Message Status SuccessTerminalStatus": {
"$ref": "./examples/GetOperationStatusReturnsSuccessTerminalStatus.json"
}
}
}
},
"/emails:send": {
"post": {
"tags": [
"EmailSend"
],
"summary": "Queues an email message to be sent to one or more recipients",
"operationId": "Email_Send",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"parameters": [
{
"in": "header",
"name": "Operation-Id",
"description": "This is the ID used by the status monitor for this long running operation.",
"type": "string",
"required": false,
"format": "uuid"
},
{
"in": "header",
"name": "x-ms-client-request-id",
"description": "Tracking ID sent with the request to help with debugging.",
"type": "string",
"required": false,
"format": "uuid",
"x-ms-client-name": "ClientRequestId"
},
{
"$ref": "#/parameters/ApiVersionParameter"
},
{
"in": "body",
"name": "emailMessage",
"description": "Message payload for sending an email",
"required": true,
"x-ms-client-name": "message",
"schema": {
"$ref": "#/definitions/EmailMessage"
}
}
],
"responses": {
"default": {
"description": "Error",
"headers": {
"x-ms-error-code": {
"description": "Error code - this will be the same as the code in the error property in the response body.",
"type": "string"
}
},
"schema": {
"$ref": "../../../../../common-types/data-plane/v1/types.json#/definitions/ErrorResponse"
}
},
"202": {
"description": "The service has accepted the request and will start processing the message later. It will return 'Accepted' immediately and include an 'Operation-Location' header. Client side should further query the operation/message status using the URL specified in 'Operation-Location' header. Once the send operation has succeeded, you can get additional status about email delivery through event grid events (for events reference, please refer to: https://learn.microsoft.com/en-us/azure/event-grid/communication-services-email-events)",
"headers": {
"Operation-Location": {
"description": "Location url of where to poll the status of this operation from.",
"type": "string"
},
"retry-after": {
"description": "This header will only be present when the operation status is a non-terminal status. It indicates the minimum amount of time in seconds to wait before polling for operation status again.",
"type": "integer",
"format": "int32"
}
},
"schema": {
"$ref": "#/definitions/EmailSendResult"
}
}
},
"x-ms-long-running-operation": true,
"x-ms-long-running-operation-options": {
"final-state-via": "azure-async-operation"
},
"x-ms-examples": {
"Send Email": {
"$ref": "./examples/SendEmail.json"
}
}
}
}
},
"definitions": {
"EmailSendResult": {
"description": "Status of the long running operation",
"required": [
"id",
"status"
],
"type": "object",
"properties": {
"id": {
"description": "The unique id of the operation. Use a UUID.",
"type": "string",
"example": "8540c0de-899f-5cce-acb5-3ec493af3800"
},
"status": {
"description": "Status of operation.",
"enum": [
"NotStarted",
"Running",
"Succeeded",
"Failed",
"Canceled"
],
"type": "string",
"x-ms-enum": {
"name": "EmailSendStatus",
"modelAsString": true
}
},
"error": {
"description": "Error details when status is a non-success terminal state.",
"$ref": "../../../../../common-types/data-plane/v1/types.json#/definitions/ErrorDetail"
}
}
},
"EmailMessage": {
"description": "Message payload for sending an email",
"required": [
"senderAddress",
"content",
"recipients"
],
"type": "object",
"properties": {
"headers": {
"description": "Custom email headers to be passed.",
"type": "object",
"additionalProperties": {
"type": "string"
}
},
"senderAddress": {
"description": "Sender email address from a verified domain.",
"type": "string",
"example": "[email protected]"
},
"content": {
"description": "Email content to be sent.",
"$ref": "#/definitions/EmailContent"
},
"recipients": {
"description": "Recipients for the email.",
"$ref": "#/definitions/EmailRecipients"
},
"attachments": {
"description": "List of attachments. Please note that we limit the total size of an email request (which includes attachments) to 10MB.",
"type": "array",
"items": {
"$ref": "#/definitions/EmailAttachment"
}
},
"replyTo": {
"description": "Email addresses where recipients' replies will be sent to.",
"type": "array",
"items": {
"$ref": "#/definitions/EmailAddress"
}
},
"userEngagementTrackingDisabled": {
"description": "Indicates whether user engagement tracking should be disabled for this request if the resource-level user engagement tracking setting was already enabled in the control plane.",
"type": "boolean"
}
}
},
"EmailAddress": {
"description": "An object representing the email address and its display name",
"type": "object",
"required": [
"address"
],
"properties": {
"address": {
"description": "Email address.",
"type": "string",
"example": "[email protected]"
},
"displayName": {
"description": "Email display name.",
"type": "string",
"example": "abc"
}
}
},
"EmailContent": {
"description": "Content of the email.",
"type": "object",
"required": [
"subject"
],
"properties": {
"subject": {
"description": "Subject of the email message",
"type": "string",
"example": "An exciting offer especially for you!"
},
"plainText": {
"description": "Plain text version of the email message.",
"type": "string",
"example": "This exciting offer was created especially for you, our most loyal customer."
},
"html": {
"description": "Html version of the email message.",
"type": "string",
"example": "<html><head><title>Exciting offer!</title></head><body><h1>This exciting offer was created especially for you, our most loyal customer.</h1></body></html>"
}
}
},
"EmailAttachment": {
"description": "Attachment to the email.",
"type": "object",
"required": [
"name",
"contentType",
"contentInBase64"
],
"properties": {
"name": {
"description": "Name of the attachment",
"type": "string",
"example": "attachment.pdf"
},
"contentType": {
"description": "MIME type of the content being attached.",
"type": "string",
"example": "text/plain"
},
"contentInBase64": {
"description": "Base64 encoded contents of the attachment",
"type": "string",
"example": "TWFueSBoYW5kcyBtYWtlIGxpZ2h0I"
}
}
},
"EmailRecipients": {
"description": "Recipients of the email",
"type": "object",
"required": [
"to"
],
"properties": {
"to": {
"description": "Email To recipients",
"type": "array",
"items": {
"$ref": "#/definitions/EmailAddress"
}
},
"cc": {
"description": "Email CC recipients",
"type": "array",
"x-ms-client-name": "CC",
"items": {
"$ref": "#/definitions/EmailAddress"
}
},
"bcc": {
"description": "Email BCC recipients",
"type": "array",
"x-ms-client-name": "BCC",
"items": {
"$ref": "#/definitions/EmailAddress"
}
}
}
}
},
"parameters": {
"ApiVersionParameter": {
"in": "query",
"name": "api-version",
"description": "Version of API to invoke.",
"required": true,
"type": "string",
"x-ms-parameter-location": "client"
}
},
"securityDefinitions": {
"Authorization": {
"type": "apiKey",
"name": "Authorization",
"in": "header",
"description": "An authentication string containing a signature generated using HMAC-SHA256 scheme."
}
},
"security": [
{
"Authorization": []
}
],
"x-ms-parameterized-host": {
"hostTemplate": "{endpoint}",
"useSchemePrefix": false,
"parameters": [
{
"name": "endpoint",
"description": "The communication resource, for example https://my-resource.communication.azure.com",
"required": true,
"type": "string",
"format": "url",
"in": "path",
"x-ms-skip-url-encoding": true,
"x-ms-parameter-location": "client"
}
]
}
}