1<html><body> 2<style> 3 4body, h1, h2, h3, div, span, p, pre, a { 5 margin: 0; 6 padding: 0; 7 border: 0; 8 font-weight: inherit; 9 font-style: inherit; 10 font-size: 100%; 11 font-family: inherit; 12 vertical-align: baseline; 13} 14 15body { 16 font-size: 13px; 17 padding: 1em; 18} 19 20h1 { 21 font-size: 26px; 22 margin-bottom: 1em; 23} 24 25h2 { 26 font-size: 24px; 27 margin-bottom: 1em; 28} 29 30h3 { 31 font-size: 20px; 32 margin-bottom: 1em; 33 margin-top: 1em; 34} 35 36pre, code { 37 line-height: 1.5; 38 font-family: Monaco, 'DejaVu Sans Mono', 'Bitstream Vera Sans Mono', 'Lucida Console', monospace; 39} 40 41pre { 42 margin-top: 0.5em; 43} 44 45h1, h2, h3, p { 46 font-family: Arial, sans serif; 47} 48 49h1, h2, h3 { 50 border-bottom: solid #CCC 1px; 51} 52 53.toc_element { 54 margin-top: 0.5em; 55} 56 57.firstline { 58 margin-left: 2 em; 59} 60 61.method { 62 margin-top: 1em; 63 border: solid 1px #CCC; 64 padding: 1em; 65 background: #EEE; 66} 67 68.details { 69 font-weight: bold; 70 font-size: 14px; 71} 72 73</style> 74 75<h1><a href="gmail_v1.html">Gmail API</a> . <a href="gmail_v1.users.html">users</a> . <a href="gmail_v1.users.drafts.html">drafts</a></h1> 76<h2>Instance Methods</h2> 77<p class="toc_element"> 78 <code><a href="#close">close()</a></code></p> 79<p class="firstline">Close httplib2 connections.</p> 80<p class="toc_element"> 81 <code><a href="#create">create(userId, body=None, media_body=None, media_mime_type=None, x__xgafv=None)</a></code></p> 82<p class="firstline">Creates a new draft with the `DRAFT` label.</p> 83<p class="toc_element"> 84 <code><a href="#delete">delete(userId, id, x__xgafv=None)</a></code></p> 85<p class="firstline">Immediately and permanently deletes the specified draft. Does not simply trash it.</p> 86<p class="toc_element"> 87 <code><a href="#get">get(userId, id, format=None, x__xgafv=None)</a></code></p> 88<p class="firstline">Gets the specified draft.</p> 89<p class="toc_element"> 90 <code><a href="#list">list(userId, includeSpamTrash=None, maxResults=None, pageToken=None, q=None, x__xgafv=None)</a></code></p> 91<p class="firstline">Lists the drafts in the user's mailbox.</p> 92<p class="toc_element"> 93 <code><a href="#list_next">list_next(previous_request, previous_response)</a></code></p> 94<p class="firstline">Retrieves the next page of results.</p> 95<p class="toc_element"> 96 <code><a href="#send">send(userId, body=None, media_body=None, media_mime_type=None, x__xgafv=None)</a></code></p> 97<p class="firstline">Sends the specified, existing draft to the recipients in the `To`, `Cc`, and `Bcc` headers.</p> 98<p class="toc_element"> 99 <code><a href="#update">update(userId, id, body=None, media_body=None, media_mime_type=None, x__xgafv=None)</a></code></p> 100<p class="firstline">Replaces a draft's content.</p> 101<h3>Method Details</h3> 102<div class="method"> 103 <code class="details" id="close">close()</code> 104 <pre>Close httplib2 connections.</pre> 105</div> 106 107<div class="method"> 108 <code class="details" id="create">create(userId, body=None, media_body=None, media_mime_type=None, x__xgafv=None)</code> 109 <pre>Creates a new draft with the `DRAFT` label. 110 111Args: 112 userId: string, The user's email address. The special value `me` can be used to indicate the authenticated user. (required) 113 body: object, The request body. 114 The object takes the form of: 115 116{ # A draft email in the user's mailbox. 117 "id": "A String", # The immutable ID of the draft. 118 "message": { # An email message. # The message content of the draft. 119 "historyId": "A String", # The ID of the last history record that modified this message. 120 "id": "A String", # The immutable ID of the message. 121 "internalDate": "A String", # The internal message creation timestamp (epoch ms), which determines ordering in the inbox. For normal SMTP-received email, this represents the time the message was originally accepted by Google, which is more reliable than the `Date` header. However, for API-migrated mail, it can be configured by client to be based on the `Date` header. 122 "labelIds": [ # List of IDs of labels applied to this message. 123 "A String", 124 ], 125 "payload": { # A single MIME message part. # The parsed email structure in the message parts. 126 "body": { # The body of a single MIME message part. # The message part body for this part, which may be empty for container MIME message parts. 127 "attachmentId": "A String", # When present, contains the ID of an external attachment that can be retrieved in a separate `messages.attachments.get` request. When not present, the entire content of the message part body is contained in the data field. 128 "data": "A String", # The body data of a MIME message part as a base64url encoded string. May be empty for MIME container types that have no message body or when the body data is sent as a separate attachment. An attachment ID is present if the body data is contained in a separate attachment. 129 "size": 42, # Number of bytes for the message part data (encoding notwithstanding). 130 }, 131 "filename": "A String", # The filename of the attachment. Only present if this message part represents an attachment. 132 "headers": [ # List of headers on this message part. For the top-level message part, representing the entire message payload, it will contain the standard RFC 2822 email headers such as `To`, `From`, and `Subject`. 133 { 134 "name": "A String", # The name of the header before the `:` separator. For example, `To`. 135 "value": "A String", # The value of the header after the `:` separator. For example, `[email protected]`. 136 }, 137 ], 138 "mimeType": "A String", # The MIME type of the message part. 139 "partId": "A String", # The immutable ID of the message part. 140 "parts": [ # The child MIME message parts of this part. This only applies to container MIME message parts, for example `multipart/*`. For non- container MIME message part types, such as `text/plain`, this field is empty. For more information, see RFC 1521. 141 # Object with schema name: MessagePart 142 ], 143 }, 144 "raw": "A String", # The entire email message in an RFC 2822 formatted and base64url encoded string. Returned in `messages.get` and `drafts.get` responses when the `format=RAW` parameter is supplied. 145 "sizeEstimate": 42, # Estimated size in bytes of the message. 146 "snippet": "A String", # A short part of the message text. 147 "threadId": "A String", # The ID of the thread the message belongs to. To add a message or draft to a thread, the following criteria must be met: 1. The requested `threadId` must be specified on the `Message` or `Draft.Message` you supply with your request. 2. The `References` and `In-Reply-To` headers must be set in compliance with the [RFC 2822](https://tools.ietf.org/html/rfc2822) standard. 3. The `Subject` headers must match. 148 }, 149} 150 151 media_body: string, The filename of the media request body, or an instance of a MediaUpload object. 152 media_mime_type: string, The MIME type of the media request body, or an instance of a MediaUpload object. 153 x__xgafv: string, V1 error format. 154 Allowed values 155 1 - v1 error format 156 2 - v2 error format 157 158Returns: 159 An object of the form: 160 161 { # A draft email in the user's mailbox. 162 "id": "A String", # The immutable ID of the draft. 163 "message": { # An email message. # The message content of the draft. 164 "historyId": "A String", # The ID of the last history record that modified this message. 165 "id": "A String", # The immutable ID of the message. 166 "internalDate": "A String", # The internal message creation timestamp (epoch ms), which determines ordering in the inbox. For normal SMTP-received email, this represents the time the message was originally accepted by Google, which is more reliable than the `Date` header. However, for API-migrated mail, it can be configured by client to be based on the `Date` header. 167 "labelIds": [ # List of IDs of labels applied to this message. 168 "A String", 169 ], 170 "payload": { # A single MIME message part. # The parsed email structure in the message parts. 171 "body": { # The body of a single MIME message part. # The message part body for this part, which may be empty for container MIME message parts. 172 "attachmentId": "A String", # When present, contains the ID of an external attachment that can be retrieved in a separate `messages.attachments.get` request. When not present, the entire content of the message part body is contained in the data field. 173 "data": "A String", # The body data of a MIME message part as a base64url encoded string. May be empty for MIME container types that have no message body or when the body data is sent as a separate attachment. An attachment ID is present if the body data is contained in a separate attachment. 174 "size": 42, # Number of bytes for the message part data (encoding notwithstanding). 175 }, 176 "filename": "A String", # The filename of the attachment. Only present if this message part represents an attachment. 177 "headers": [ # List of headers on this message part. For the top-level message part, representing the entire message payload, it will contain the standard RFC 2822 email headers such as `To`, `From`, and `Subject`. 178 { 179 "name": "A String", # The name of the header before the `:` separator. For example, `To`. 180 "value": "A String", # The value of the header after the `:` separator. For example, `[email protected]`. 181 }, 182 ], 183 "mimeType": "A String", # The MIME type of the message part. 184 "partId": "A String", # The immutable ID of the message part. 185 "parts": [ # The child MIME message parts of this part. This only applies to container MIME message parts, for example `multipart/*`. For non- container MIME message part types, such as `text/plain`, this field is empty. For more information, see RFC 1521. 186 # Object with schema name: MessagePart 187 ], 188 }, 189 "raw": "A String", # The entire email message in an RFC 2822 formatted and base64url encoded string. Returned in `messages.get` and `drafts.get` responses when the `format=RAW` parameter is supplied. 190 "sizeEstimate": 42, # Estimated size in bytes of the message. 191 "snippet": "A String", # A short part of the message text. 192 "threadId": "A String", # The ID of the thread the message belongs to. To add a message or draft to a thread, the following criteria must be met: 1. The requested `threadId` must be specified on the `Message` or `Draft.Message` you supply with your request. 2. The `References` and `In-Reply-To` headers must be set in compliance with the [RFC 2822](https://tools.ietf.org/html/rfc2822) standard. 3. The `Subject` headers must match. 193 }, 194}</pre> 195</div> 196 197<div class="method"> 198 <code class="details" id="delete">delete(userId, id, x__xgafv=None)</code> 199 <pre>Immediately and permanently deletes the specified draft. Does not simply trash it. 200 201Args: 202 userId: string, The user's email address. The special value `me` can be used to indicate the authenticated user. (required) 203 id: string, The ID of the draft to delete. (required) 204 x__xgafv: string, V1 error format. 205 Allowed values 206 1 - v1 error format 207 2 - v2 error format 208</pre> 209</div> 210 211<div class="method"> 212 <code class="details" id="get">get(userId, id, format=None, x__xgafv=None)</code> 213 <pre>Gets the specified draft. 214 215Args: 216 userId: string, The user's email address. The special value `me` can be used to indicate the authenticated user. (required) 217 id: string, The ID of the draft to retrieve. (required) 218 format: string, The format to return the draft in. 219 Allowed values 220 minimal - Returns only email message ID and labels; does not return the email headers, body, or payload. 221 full - Returns the full email message data with body content parsed in the `payload` field; the `raw` field is not used. Format cannot be used when accessing the api using the gmail.metadata scope. 222 raw - Returns the full email message data with body content in the `raw` field as a base64url encoded string; the `payload` field is not used. Format cannot be used when accessing the api using the gmail.metadata scope. 223 metadata - Returns only email message ID, labels, and email headers. 224 x__xgafv: string, V1 error format. 225 Allowed values 226 1 - v1 error format 227 2 - v2 error format 228 229Returns: 230 An object of the form: 231 232 { # A draft email in the user's mailbox. 233 "id": "A String", # The immutable ID of the draft. 234 "message": { # An email message. # The message content of the draft. 235 "historyId": "A String", # The ID of the last history record that modified this message. 236 "id": "A String", # The immutable ID of the message. 237 "internalDate": "A String", # The internal message creation timestamp (epoch ms), which determines ordering in the inbox. For normal SMTP-received email, this represents the time the message was originally accepted by Google, which is more reliable than the `Date` header. However, for API-migrated mail, it can be configured by client to be based on the `Date` header. 238 "labelIds": [ # List of IDs of labels applied to this message. 239 "A String", 240 ], 241 "payload": { # A single MIME message part. # The parsed email structure in the message parts. 242 "body": { # The body of a single MIME message part. # The message part body for this part, which may be empty for container MIME message parts. 243 "attachmentId": "A String", # When present, contains the ID of an external attachment that can be retrieved in a separate `messages.attachments.get` request. When not present, the entire content of the message part body is contained in the data field. 244 "data": "A String", # The body data of a MIME message part as a base64url encoded string. May be empty for MIME container types that have no message body or when the body data is sent as a separate attachment. An attachment ID is present if the body data is contained in a separate attachment. 245 "size": 42, # Number of bytes for the message part data (encoding notwithstanding). 246 }, 247 "filename": "A String", # The filename of the attachment. Only present if this message part represents an attachment. 248 "headers": [ # List of headers on this message part. For the top-level message part, representing the entire message payload, it will contain the standard RFC 2822 email headers such as `To`, `From`, and `Subject`. 249 { 250 "name": "A String", # The name of the header before the `:` separator. For example, `To`. 251 "value": "A String", # The value of the header after the `:` separator. For example, `[email protected]`. 252 }, 253 ], 254 "mimeType": "A String", # The MIME type of the message part. 255 "partId": "A String", # The immutable ID of the message part. 256 "parts": [ # The child MIME message parts of this part. This only applies to container MIME message parts, for example `multipart/*`. For non- container MIME message part types, such as `text/plain`, this field is empty. For more information, see RFC 1521. 257 # Object with schema name: MessagePart 258 ], 259 }, 260 "raw": "A String", # The entire email message in an RFC 2822 formatted and base64url encoded string. Returned in `messages.get` and `drafts.get` responses when the `format=RAW` parameter is supplied. 261 "sizeEstimate": 42, # Estimated size in bytes of the message. 262 "snippet": "A String", # A short part of the message text. 263 "threadId": "A String", # The ID of the thread the message belongs to. To add a message or draft to a thread, the following criteria must be met: 1. The requested `threadId` must be specified on the `Message` or `Draft.Message` you supply with your request. 2. The `References` and `In-Reply-To` headers must be set in compliance with the [RFC 2822](https://tools.ietf.org/html/rfc2822) standard. 3. The `Subject` headers must match. 264 }, 265}</pre> 266</div> 267 268<div class="method"> 269 <code class="details" id="list">list(userId, includeSpamTrash=None, maxResults=None, pageToken=None, q=None, x__xgafv=None)</code> 270 <pre>Lists the drafts in the user's mailbox. 271 272Args: 273 userId: string, The user's email address. The special value `me` can be used to indicate the authenticated user. (required) 274 includeSpamTrash: boolean, Include drafts from `SPAM` and `TRASH` in the results. 275 maxResults: integer, Maximum number of drafts to return. This field defaults to 100. The maximum allowed value for this field is 500. 276 pageToken: string, Page token to retrieve a specific page of results in the list. 277 q: string, Only return draft messages matching the specified query. Supports the same query format as the Gmail search box. For example, `"from:[email protected] rfc822msgid: is:unread"`. 278 x__xgafv: string, V1 error format. 279 Allowed values 280 1 - v1 error format 281 2 - v2 error format 282 283Returns: 284 An object of the form: 285 286 { 287 "drafts": [ # List of drafts. Note that the `Message` property in each `Draft` resource only contains an `id` and a `threadId`. The messages.get method can fetch additional message details. 288 { # A draft email in the user's mailbox. 289 "id": "A String", # The immutable ID of the draft. 290 "message": { # An email message. # The message content of the draft. 291 "historyId": "A String", # The ID of the last history record that modified this message. 292 "id": "A String", # The immutable ID of the message. 293 "internalDate": "A String", # The internal message creation timestamp (epoch ms), which determines ordering in the inbox. For normal SMTP-received email, this represents the time the message was originally accepted by Google, which is more reliable than the `Date` header. However, for API-migrated mail, it can be configured by client to be based on the `Date` header. 294 "labelIds": [ # List of IDs of labels applied to this message. 295 "A String", 296 ], 297 "payload": { # A single MIME message part. # The parsed email structure in the message parts. 298 "body": { # The body of a single MIME message part. # The message part body for this part, which may be empty for container MIME message parts. 299 "attachmentId": "A String", # When present, contains the ID of an external attachment that can be retrieved in a separate `messages.attachments.get` request. When not present, the entire content of the message part body is contained in the data field. 300 "data": "A String", # The body data of a MIME message part as a base64url encoded string. May be empty for MIME container types that have no message body or when the body data is sent as a separate attachment. An attachment ID is present if the body data is contained in a separate attachment. 301 "size": 42, # Number of bytes for the message part data (encoding notwithstanding). 302 }, 303 "filename": "A String", # The filename of the attachment. Only present if this message part represents an attachment. 304 "headers": [ # List of headers on this message part. For the top-level message part, representing the entire message payload, it will contain the standard RFC 2822 email headers such as `To`, `From`, and `Subject`. 305 { 306 "name": "A String", # The name of the header before the `:` separator. For example, `To`. 307 "value": "A String", # The value of the header after the `:` separator. For example, `[email protected]`. 308 }, 309 ], 310 "mimeType": "A String", # The MIME type of the message part. 311 "partId": "A String", # The immutable ID of the message part. 312 "parts": [ # The child MIME message parts of this part. This only applies to container MIME message parts, for example `multipart/*`. For non- container MIME message part types, such as `text/plain`, this field is empty. For more information, see RFC 1521. 313 # Object with schema name: MessagePart 314 ], 315 }, 316 "raw": "A String", # The entire email message in an RFC 2822 formatted and base64url encoded string. Returned in `messages.get` and `drafts.get` responses when the `format=RAW` parameter is supplied. 317 "sizeEstimate": 42, # Estimated size in bytes of the message. 318 "snippet": "A String", # A short part of the message text. 319 "threadId": "A String", # The ID of the thread the message belongs to. To add a message or draft to a thread, the following criteria must be met: 1. The requested `threadId` must be specified on the `Message` or `Draft.Message` you supply with your request. 2. The `References` and `In-Reply-To` headers must be set in compliance with the [RFC 2822](https://tools.ietf.org/html/rfc2822) standard. 3. The `Subject` headers must match. 320 }, 321 }, 322 ], 323 "nextPageToken": "A String", # Token to retrieve the next page of results in the list. 324 "resultSizeEstimate": 42, # Estimated total number of results. 325}</pre> 326</div> 327 328<div class="method"> 329 <code class="details" id="list_next">list_next(previous_request, previous_response)</code> 330 <pre>Retrieves the next page of results. 331 332Args: 333 previous_request: The request for the previous page. (required) 334 previous_response: The response from the request for the previous page. (required) 335 336Returns: 337 A request object that you can call 'execute()' on to request the next 338 page. Returns None if there are no more items in the collection. 339 </pre> 340</div> 341 342<div class="method"> 343 <code class="details" id="send">send(userId, body=None, media_body=None, media_mime_type=None, x__xgafv=None)</code> 344 <pre>Sends the specified, existing draft to the recipients in the `To`, `Cc`, and `Bcc` headers. 345 346Args: 347 userId: string, The user's email address. The special value `me` can be used to indicate the authenticated user. (required) 348 body: object, The request body. 349 The object takes the form of: 350 351{ # A draft email in the user's mailbox. 352 "id": "A String", # The immutable ID of the draft. 353 "message": { # An email message. # The message content of the draft. 354 "historyId": "A String", # The ID of the last history record that modified this message. 355 "id": "A String", # The immutable ID of the message. 356 "internalDate": "A String", # The internal message creation timestamp (epoch ms), which determines ordering in the inbox. For normal SMTP-received email, this represents the time the message was originally accepted by Google, which is more reliable than the `Date` header. However, for API-migrated mail, it can be configured by client to be based on the `Date` header. 357 "labelIds": [ # List of IDs of labels applied to this message. 358 "A String", 359 ], 360 "payload": { # A single MIME message part. # The parsed email structure in the message parts. 361 "body": { # The body of a single MIME message part. # The message part body for this part, which may be empty for container MIME message parts. 362 "attachmentId": "A String", # When present, contains the ID of an external attachment that can be retrieved in a separate `messages.attachments.get` request. When not present, the entire content of the message part body is contained in the data field. 363 "data": "A String", # The body data of a MIME message part as a base64url encoded string. May be empty for MIME container types that have no message body or when the body data is sent as a separate attachment. An attachment ID is present if the body data is contained in a separate attachment. 364 "size": 42, # Number of bytes for the message part data (encoding notwithstanding). 365 }, 366 "filename": "A String", # The filename of the attachment. Only present if this message part represents an attachment. 367 "headers": [ # List of headers on this message part. For the top-level message part, representing the entire message payload, it will contain the standard RFC 2822 email headers such as `To`, `From`, and `Subject`. 368 { 369 "name": "A String", # The name of the header before the `:` separator. For example, `To`. 370 "value": "A String", # The value of the header after the `:` separator. For example, `[email protected]`. 371 }, 372 ], 373 "mimeType": "A String", # The MIME type of the message part. 374 "partId": "A String", # The immutable ID of the message part. 375 "parts": [ # The child MIME message parts of this part. This only applies to container MIME message parts, for example `multipart/*`. For non- container MIME message part types, such as `text/plain`, this field is empty. For more information, see RFC 1521. 376 # Object with schema name: MessagePart 377 ], 378 }, 379 "raw": "A String", # The entire email message in an RFC 2822 formatted and base64url encoded string. Returned in `messages.get` and `drafts.get` responses when the `format=RAW` parameter is supplied. 380 "sizeEstimate": 42, # Estimated size in bytes of the message. 381 "snippet": "A String", # A short part of the message text. 382 "threadId": "A String", # The ID of the thread the message belongs to. To add a message or draft to a thread, the following criteria must be met: 1. The requested `threadId` must be specified on the `Message` or `Draft.Message` you supply with your request. 2. The `References` and `In-Reply-To` headers must be set in compliance with the [RFC 2822](https://tools.ietf.org/html/rfc2822) standard. 3. The `Subject` headers must match. 383 }, 384} 385 386 media_body: string, The filename of the media request body, or an instance of a MediaUpload object. 387 media_mime_type: string, The MIME type of the media request body, or an instance of a MediaUpload object. 388 x__xgafv: string, V1 error format. 389 Allowed values 390 1 - v1 error format 391 2 - v2 error format 392 393Returns: 394 An object of the form: 395 396 { # An email message. 397 "historyId": "A String", # The ID of the last history record that modified this message. 398 "id": "A String", # The immutable ID of the message. 399 "internalDate": "A String", # The internal message creation timestamp (epoch ms), which determines ordering in the inbox. For normal SMTP-received email, this represents the time the message was originally accepted by Google, which is more reliable than the `Date` header. However, for API-migrated mail, it can be configured by client to be based on the `Date` header. 400 "labelIds": [ # List of IDs of labels applied to this message. 401 "A String", 402 ], 403 "payload": { # A single MIME message part. # The parsed email structure in the message parts. 404 "body": { # The body of a single MIME message part. # The message part body for this part, which may be empty for container MIME message parts. 405 "attachmentId": "A String", # When present, contains the ID of an external attachment that can be retrieved in a separate `messages.attachments.get` request. When not present, the entire content of the message part body is contained in the data field. 406 "data": "A String", # The body data of a MIME message part as a base64url encoded string. May be empty for MIME container types that have no message body or when the body data is sent as a separate attachment. An attachment ID is present if the body data is contained in a separate attachment. 407 "size": 42, # Number of bytes for the message part data (encoding notwithstanding). 408 }, 409 "filename": "A String", # The filename of the attachment. Only present if this message part represents an attachment. 410 "headers": [ # List of headers on this message part. For the top-level message part, representing the entire message payload, it will contain the standard RFC 2822 email headers such as `To`, `From`, and `Subject`. 411 { 412 "name": "A String", # The name of the header before the `:` separator. For example, `To`. 413 "value": "A String", # The value of the header after the `:` separator. For example, `[email protected]`. 414 }, 415 ], 416 "mimeType": "A String", # The MIME type of the message part. 417 "partId": "A String", # The immutable ID of the message part. 418 "parts": [ # The child MIME message parts of this part. This only applies to container MIME message parts, for example `multipart/*`. For non- container MIME message part types, such as `text/plain`, this field is empty. For more information, see RFC 1521. 419 # Object with schema name: MessagePart 420 ], 421 }, 422 "raw": "A String", # The entire email message in an RFC 2822 formatted and base64url encoded string. Returned in `messages.get` and `drafts.get` responses when the `format=RAW` parameter is supplied. 423 "sizeEstimate": 42, # Estimated size in bytes of the message. 424 "snippet": "A String", # A short part of the message text. 425 "threadId": "A String", # The ID of the thread the message belongs to. To add a message or draft to a thread, the following criteria must be met: 1. The requested `threadId` must be specified on the `Message` or `Draft.Message` you supply with your request. 2. The `References` and `In-Reply-To` headers must be set in compliance with the [RFC 2822](https://tools.ietf.org/html/rfc2822) standard. 3. The `Subject` headers must match. 426}</pre> 427</div> 428 429<div class="method"> 430 <code class="details" id="update">update(userId, id, body=None, media_body=None, media_mime_type=None, x__xgafv=None)</code> 431 <pre>Replaces a draft's content. 432 433Args: 434 userId: string, The user's email address. The special value `me` can be used to indicate the authenticated user. (required) 435 id: string, The ID of the draft to update. (required) 436 body: object, The request body. 437 The object takes the form of: 438 439{ # A draft email in the user's mailbox. 440 "id": "A String", # The immutable ID of the draft. 441 "message": { # An email message. # The message content of the draft. 442 "historyId": "A String", # The ID of the last history record that modified this message. 443 "id": "A String", # The immutable ID of the message. 444 "internalDate": "A String", # The internal message creation timestamp (epoch ms), which determines ordering in the inbox. For normal SMTP-received email, this represents the time the message was originally accepted by Google, which is more reliable than the `Date` header. However, for API-migrated mail, it can be configured by client to be based on the `Date` header. 445 "labelIds": [ # List of IDs of labels applied to this message. 446 "A String", 447 ], 448 "payload": { # A single MIME message part. # The parsed email structure in the message parts. 449 "body": { # The body of a single MIME message part. # The message part body for this part, which may be empty for container MIME message parts. 450 "attachmentId": "A String", # When present, contains the ID of an external attachment that can be retrieved in a separate `messages.attachments.get` request. When not present, the entire content of the message part body is contained in the data field. 451 "data": "A String", # The body data of a MIME message part as a base64url encoded string. May be empty for MIME container types that have no message body or when the body data is sent as a separate attachment. An attachment ID is present if the body data is contained in a separate attachment. 452 "size": 42, # Number of bytes for the message part data (encoding notwithstanding). 453 }, 454 "filename": "A String", # The filename of the attachment. Only present if this message part represents an attachment. 455 "headers": [ # List of headers on this message part. For the top-level message part, representing the entire message payload, it will contain the standard RFC 2822 email headers such as `To`, `From`, and `Subject`. 456 { 457 "name": "A String", # The name of the header before the `:` separator. For example, `To`. 458 "value": "A String", # The value of the header after the `:` separator. For example, `[email protected]`. 459 }, 460 ], 461 "mimeType": "A String", # The MIME type of the message part. 462 "partId": "A String", # The immutable ID of the message part. 463 "parts": [ # The child MIME message parts of this part. This only applies to container MIME message parts, for example `multipart/*`. For non- container MIME message part types, such as `text/plain`, this field is empty. For more information, see RFC 1521. 464 # Object with schema name: MessagePart 465 ], 466 }, 467 "raw": "A String", # The entire email message in an RFC 2822 formatted and base64url encoded string. Returned in `messages.get` and `drafts.get` responses when the `format=RAW` parameter is supplied. 468 "sizeEstimate": 42, # Estimated size in bytes of the message. 469 "snippet": "A String", # A short part of the message text. 470 "threadId": "A String", # The ID of the thread the message belongs to. To add a message or draft to a thread, the following criteria must be met: 1. The requested `threadId` must be specified on the `Message` or `Draft.Message` you supply with your request. 2. The `References` and `In-Reply-To` headers must be set in compliance with the [RFC 2822](https://tools.ietf.org/html/rfc2822) standard. 3. The `Subject` headers must match. 471 }, 472} 473 474 media_body: string, The filename of the media request body, or an instance of a MediaUpload object. 475 media_mime_type: string, The MIME type of the media request body, or an instance of a MediaUpload object. 476 x__xgafv: string, V1 error format. 477 Allowed values 478 1 - v1 error format 479 2 - v2 error format 480 481Returns: 482 An object of the form: 483 484 { # A draft email in the user's mailbox. 485 "id": "A String", # The immutable ID of the draft. 486 "message": { # An email message. # The message content of the draft. 487 "historyId": "A String", # The ID of the last history record that modified this message. 488 "id": "A String", # The immutable ID of the message. 489 "internalDate": "A String", # The internal message creation timestamp (epoch ms), which determines ordering in the inbox. For normal SMTP-received email, this represents the time the message was originally accepted by Google, which is more reliable than the `Date` header. However, for API-migrated mail, it can be configured by client to be based on the `Date` header. 490 "labelIds": [ # List of IDs of labels applied to this message. 491 "A String", 492 ], 493 "payload": { # A single MIME message part. # The parsed email structure in the message parts. 494 "body": { # The body of a single MIME message part. # The message part body for this part, which may be empty for container MIME message parts. 495 "attachmentId": "A String", # When present, contains the ID of an external attachment that can be retrieved in a separate `messages.attachments.get` request. When not present, the entire content of the message part body is contained in the data field. 496 "data": "A String", # The body data of a MIME message part as a base64url encoded string. May be empty for MIME container types that have no message body or when the body data is sent as a separate attachment. An attachment ID is present if the body data is contained in a separate attachment. 497 "size": 42, # Number of bytes for the message part data (encoding notwithstanding). 498 }, 499 "filename": "A String", # The filename of the attachment. Only present if this message part represents an attachment. 500 "headers": [ # List of headers on this message part. For the top-level message part, representing the entire message payload, it will contain the standard RFC 2822 email headers such as `To`, `From`, and `Subject`. 501 { 502 "name": "A String", # The name of the header before the `:` separator. For example, `To`. 503 "value": "A String", # The value of the header after the `:` separator. For example, `[email protected]`. 504 }, 505 ], 506 "mimeType": "A String", # The MIME type of the message part. 507 "partId": "A String", # The immutable ID of the message part. 508 "parts": [ # The child MIME message parts of this part. This only applies to container MIME message parts, for example `multipart/*`. For non- container MIME message part types, such as `text/plain`, this field is empty. For more information, see RFC 1521. 509 # Object with schema name: MessagePart 510 ], 511 }, 512 "raw": "A String", # The entire email message in an RFC 2822 formatted and base64url encoded string. Returned in `messages.get` and `drafts.get` responses when the `format=RAW` parameter is supplied. 513 "sizeEstimate": 42, # Estimated size in bytes of the message. 514 "snippet": "A String", # A short part of the message text. 515 "threadId": "A String", # The ID of the thread the message belongs to. To add a message or draft to a thread, the following criteria must be met: 1. The requested `threadId` must be specified on the `Message` or `Draft.Message` you supply with your request. 2. The `References` and `In-Reply-To` headers must be set in compliance with the [RFC 2822](https://tools.ietf.org/html/rfc2822) standard. 3. The `Subject` headers must match. 516 }, 517}</pre> 518</div> 519 520</body></html>