This site contains the documentation that is relevant to older WSO2 product versions and offerings.
For the latest WSO2 documentation, visit https://wso2.com/documentation/.
Working with User History in Gmail
Overview
The following operations allow you to work with user history. Click an operation name to see details on how to use it.
For a sample proxy service that illustrates how to work with user history, see Sample configuration.
Operation | Description |
---|---|
Lists the history of changes to the user's mailbox |
Operation details
This section provides further details on the operations related to user history.
Listing the user's history
The listTheHistory
operation lists the history of changes to the user's mailbox.
<gmail.listTheHistory> <startHistoryId>{$ctx:startHistoryId}</startHistoryId> <labelId>{$ctx:labelId}</labelId> <maxResults>{$ctx:maxResults}</maxResults> <pageToken>{$ctx:pageToken}</pageToken> </gmail.listTheHistory>
Properties
startHistoryId
: Returns history records after the specifiedstartHistoryId
.labelId
: Only return messages with a label matching the ID.maxResults
: The maximum number of history records to return.pageToken
: Page token to retrieve a specific page of results in the list.
Sample request
Following is a sample REST/JSON request that can be handled by the listTheHistory
operation.
{ "startHistoryId":"7399652", "labelId":"Label_31", "maxResults":"10" }
Related Gmail documentation
https://developers.google.com/gmail/api/v1/reference/users/history/list
Sample configuration
Following is a sample proxy service that illustrates how to connect to Gmail with the init
operation and use the listTheHistory
operation. The sample request for this proxy can be found in listTheHistory sample request.
<proxy xmlns="http://ws.apache.org/ns/synapse" name="gmail_listTheHistory" transports="https,http" statistics="disable" trace="disable" startOnLoad="true"> <target> <inSequence> <property name="startHistoryId" expression="json-eval($.startHistoryId)"/> <property name="labelId" expression="json-eval($.labelId)"/> <property name="maxResults" expression="json-eval($.maxResults)"/> <property name="pageToken" expression="json-eval($.pageToken)"/> <property name="userId" expression="json-eval($.userId)"/> <property name="refreshToken" expression="json-eval($.refreshToken)"/> <property name="clientId" expression="json-eval($.clientId)"/> <property name="clientSecret" expression="json-eval($.clientSecret)"/> <property name="accessToken" expression="json-eval($.accessToken)"/> <property name="registryPath" expression="json-eval($.registryPath)"/> <property name="apiUrl" expression="json-eval($.apiUrl)"/> <gmail.init> <userId>{$ctx:userId}</userId> <refreshToken>{$ctx:refreshToken}</refreshToken> <clientSecret>{$ctx:clientSecret}</clientSecret> <clientId>{$ctx:clientId}</clientId> <registryPath>{$ctx:registryPath}</registryPath> <accessToken>{$ctx:accessToken}</accessToken> <apiUrl>{$ctx:apiUrl}</apiUrl> </gmail.init> <gmail.listTheHistory> <startHistoryId>{$ctx:startHistoryId}</startHistoryId> <labelId>{$ctx:labelId}</labelId> <maxResults>{$ctx:maxResults}</maxResults> <pageToken>{$ctx:pageToken}</pageToken> </gmail.listTheHistory> <respond/> </inSequence> <outSequence> <log/> <send/> </outSequence> </target> <parameter name="serviceType">proxy</parameter> <description/> </proxy>