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.history.html">history</a></h1> 76<h2>Instance Methods</h2> 77<p class="toc_element"> 78 <code><a href="#list">list(userId, labelId=None, pageToken=None, maxResults=None, startHistoryId=None, historyTypes=None)</a></code></p> 79<p class="firstline">Lists the history of all changes to the given mailbox. History results are returned in chronological order (increasing historyId).</p> 80<p class="toc_element"> 81 <code><a href="#list_next">list_next(previous_request, previous_response)</a></code></p> 82<p class="firstline">Retrieves the next page of results.</p> 83<h3>Method Details</h3> 84<div class="method"> 85 <code class="details" id="list">list(userId, labelId=None, pageToken=None, maxResults=None, startHistoryId=None, historyTypes=None)</code> 86 <pre>Lists the history of all changes to the given mailbox. History results are returned in chronological order (increasing historyId). 87 88Args: 89 userId: string, The user's email address. The special value me can be used to indicate the authenticated user. (required) 90 labelId: string, Only return messages with a label matching the ID. 91 pageToken: string, Page token to retrieve a specific page of results in the list. 92 maxResults: integer, The maximum number of history records to return. 93 startHistoryId: string, Required. Returns history records after the specified startHistoryId. The supplied startHistoryId should be obtained from the historyId of a message, thread, or previous list response. History IDs increase chronologically but are not contiguous with random gaps in between valid IDs. Supplying an invalid or out of date startHistoryId typically returns an HTTP 404 error code. A historyId is typically valid for at least a week, but in some rare circumstances may be valid for only a few hours. If you receive an HTTP 404 error response, your application should perform a full sync. If you receive no nextPageToken in the response, there are no updates to retrieve and you can store the returned historyId for a future request. 94 historyTypes: string, History types to be returned by the function (repeated) 95 Allowed values 96 labelAdded - 97 labelRemoved - 98 messageAdded - 99 messageDeleted - 100 101Returns: 102 An object of the form: 103 104 { 105 "nextPageToken": "A String", # Page token to retrieve the next page of results in the list. 106 "historyId": "A String", # The ID of the mailbox's current history record. 107 "history": [ # List of history records. Any messages contained in the response will typically only have id and threadId fields populated. 108 { # A record of a change to the user's mailbox. Each history change may affect multiple messages in multiple ways. 109 "labelsAdded": [ # Labels added to messages in this history record. 110 { 111 "labelIds": [ # Label IDs added to the message. 112 "A String", 113 ], 114 "message": { # An email message. 115 "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. 116 "historyId": "A String", # The ID of the last history record that modified this message. 117 "payload": { # A single MIME message part. # The parsed email structure in the message parts. 118 "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. 119 "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. 120 "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. 121 "size": 42, # Number of bytes for the message part data (encoding notwithstanding). 122 }, 123 "mimeType": "A String", # The MIME type of the message part. 124 "partId": "A String", # The immutable ID of the message part. 125 "filename": "A String", # The filename of the attachment. Only present if this message part represents an attachment. 126 "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. 127 { 128 "name": "A String", # The name of the header before the : separator. For example, To. 129 "value": "A String", # The value of the header after the : separator. For example, someuser@example.com. 130 }, 131 ], 132 "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. 133 # Object with schema name: MessagePart 134 ], 135 }, 136 "snippet": "A String", # A short part of the message text. 137 "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. 138 "sizeEstimate": 42, # Estimated size in bytes of the message. 139 "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: 140 # - The requested threadId must be specified on the Message or Draft.Message you supply with your request. 141 # - The References and In-Reply-To headers must be set in compliance with the RFC 2822 standard. 142 # - The Subject headers must match. 143 "labelIds": [ # List of IDs of labels applied to this message. 144 "A String", 145 ], 146 "id": "A String", # The immutable ID of the message. 147 }, 148 }, 149 ], 150 "messages": [ # List of messages changed in this history record. The fields for specific change types, such as messagesAdded may duplicate messages in this field. We recommend using the specific change-type fields instead of this. 151 { # An email message. 152 "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. 153 "historyId": "A String", # The ID of the last history record that modified this message. 154 "payload": { # A single MIME message part. # The parsed email structure in the message parts. 155 "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. 156 "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. 157 "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. 158 "size": 42, # Number of bytes for the message part data (encoding notwithstanding). 159 }, 160 "mimeType": "A String", # The MIME type of the message part. 161 "partId": "A String", # The immutable ID of the message part. 162 "filename": "A String", # The filename of the attachment. Only present if this message part represents an attachment. 163 "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. 164 { 165 "name": "A String", # The name of the header before the : separator. For example, To. 166 "value": "A String", # The value of the header after the : separator. For example, someuser@example.com. 167 }, 168 ], 169 "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. 170 # Object with schema name: MessagePart 171 ], 172 }, 173 "snippet": "A String", # A short part of the message text. 174 "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. 175 "sizeEstimate": 42, # Estimated size in bytes of the message. 176 "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: 177 # - The requested threadId must be specified on the Message or Draft.Message you supply with your request. 178 # - The References and In-Reply-To headers must be set in compliance with the RFC 2822 standard. 179 # - The Subject headers must match. 180 "labelIds": [ # List of IDs of labels applied to this message. 181 "A String", 182 ], 183 "id": "A String", # The immutable ID of the message. 184 }, 185 ], 186 "messagesAdded": [ # Messages added to the mailbox in this history record. 187 { 188 "message": { # An email message. 189 "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. 190 "historyId": "A String", # The ID of the last history record that modified this message. 191 "payload": { # A single MIME message part. # The parsed email structure in the message parts. 192 "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. 193 "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. 194 "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. 195 "size": 42, # Number of bytes for the message part data (encoding notwithstanding). 196 }, 197 "mimeType": "A String", # The MIME type of the message part. 198 "partId": "A String", # The immutable ID of the message part. 199 "filename": "A String", # The filename of the attachment. Only present if this message part represents an attachment. 200 "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. 201 { 202 "name": "A String", # The name of the header before the : separator. For example, To. 203 "value": "A String", # The value of the header after the : separator. For example, someuser@example.com. 204 }, 205 ], 206 "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. 207 # Object with schema name: MessagePart 208 ], 209 }, 210 "snippet": "A String", # A short part of the message text. 211 "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. 212 "sizeEstimate": 42, # Estimated size in bytes of the message. 213 "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: 214 # - The requested threadId must be specified on the Message or Draft.Message you supply with your request. 215 # - The References and In-Reply-To headers must be set in compliance with the RFC 2822 standard. 216 # - The Subject headers must match. 217 "labelIds": [ # List of IDs of labels applied to this message. 218 "A String", 219 ], 220 "id": "A String", # The immutable ID of the message. 221 }, 222 }, 223 ], 224 "labelsRemoved": [ # Labels removed from messages in this history record. 225 { 226 "labelIds": [ # Label IDs removed from the message. 227 "A String", 228 ], 229 "message": { # An email message. 230 "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. 231 "historyId": "A String", # The ID of the last history record that modified this message. 232 "payload": { # A single MIME message part. # The parsed email structure in the message parts. 233 "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. 234 "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. 235 "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. 236 "size": 42, # Number of bytes for the message part data (encoding notwithstanding). 237 }, 238 "mimeType": "A String", # The MIME type of the message part. 239 "partId": "A String", # The immutable ID of the message part. 240 "filename": "A String", # The filename of the attachment. Only present if this message part represents an attachment. 241 "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. 242 { 243 "name": "A String", # The name of the header before the : separator. For example, To. 244 "value": "A String", # The value of the header after the : separator. For example, someuser@example.com. 245 }, 246 ], 247 "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. 248 # Object with schema name: MessagePart 249 ], 250 }, 251 "snippet": "A String", # A short part of the message text. 252 "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. 253 "sizeEstimate": 42, # Estimated size in bytes of the message. 254 "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: 255 # - The requested threadId must be specified on the Message or Draft.Message you supply with your request. 256 # - The References and In-Reply-To headers must be set in compliance with the RFC 2822 standard. 257 # - The Subject headers must match. 258 "labelIds": [ # List of IDs of labels applied to this message. 259 "A String", 260 ], 261 "id": "A String", # The immutable ID of the message. 262 }, 263 }, 264 ], 265 "messagesDeleted": [ # Messages deleted (not Trashed) from the mailbox in this history record. 266 { 267 "message": { # An email message. 268 "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. 269 "historyId": "A String", # The ID of the last history record that modified this message. 270 "payload": { # A single MIME message part. # The parsed email structure in the message parts. 271 "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. 272 "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. 273 "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. 274 "size": 42, # Number of bytes for the message part data (encoding notwithstanding). 275 }, 276 "mimeType": "A String", # The MIME type of the message part. 277 "partId": "A String", # The immutable ID of the message part. 278 "filename": "A String", # The filename of the attachment. Only present if this message part represents an attachment. 279 "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. 280 { 281 "name": "A String", # The name of the header before the : separator. For example, To. 282 "value": "A String", # The value of the header after the : separator. For example, someuser@example.com. 283 }, 284 ], 285 "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. 286 # Object with schema name: MessagePart 287 ], 288 }, 289 "snippet": "A String", # A short part of the message text. 290 "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. 291 "sizeEstimate": 42, # Estimated size in bytes of the message. 292 "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: 293 # - The requested threadId must be specified on the Message or Draft.Message you supply with your request. 294 # - The References and In-Reply-To headers must be set in compliance with the RFC 2822 standard. 295 # - The Subject headers must match. 296 "labelIds": [ # List of IDs of labels applied to this message. 297 "A String", 298 ], 299 "id": "A String", # The immutable ID of the message. 300 }, 301 }, 302 ], 303 "id": "A String", # The mailbox sequence ID. 304 }, 305 ], 306 }</pre> 307</div> 308 309<div class="method"> 310 <code class="details" id="list_next">list_next(previous_request, previous_response)</code> 311 <pre>Retrieves the next page of results. 312 313Args: 314 previous_request: The request for the previous page. (required) 315 previous_response: The response from the request for the previous page. (required) 316 317Returns: 318 A request object that you can call 'execute()' on to request the next 319 page. Returns None if there are no more items in the collection. 320 </pre> 321</div> 322 323</body></html>