Discovery Document for Google Email Migration API

2019-08-28 13:26发布

Today Google announced a new version of the Email Migration API. The API appears to follow Google's normal REST format but I've been unable to determine the service name and version information for the API in order to use it with the google-api-python-client.

Is there a discovery document for the new API and if so what is the service name and version?

2条回答
地球回转人心会变
2楼-- · 2019-08-28 13:56

For now, I've been able to write my own non-standard discovery document. It's probably buggy/incomplete but it's working for me for test messages and the Python API Client.

{
 "kind": "discovery#restDescription",
 "etag": "\"BgGz67p-6wsAbOn4St98QhtBGbA/blODPd9XLaVQKZp7pexaIpilnaw\"",
 "discoveryVersion": "v1",
 "id": "emailmigration:v2",
 "name": "emailmigration",
 "version": "v2",
 "revision": "20130717",
 "title": "Email Migration API",
 "description": "API to migrate messages to Google Apps Gmail Accounts",
 "ownerDomain": "google.com",
 "ownerName": "Google",
 "documentationLink": "https://developers.google.com/admin-sdk/email-migration/",
 "protocol": "rest",
 "baseUrl": "https://www.googleapis.com/email/v2/",
 "basePath": "/email/v2/users/",
 "rootUrl": "https://www.googleapis.com/",
 "servicePath": "email/v2/users/",
 "batchPath": "batch",
 "parameters": {
  "alt": {
   "type": "string",
   "description": "Data format for the response.",
   "default": "json",
   "enum": [
    "json"
   ],
   "enumDescriptions": [
    "Responses with Content-Type of application/json"
   ],
   "location": "query"
  },
  "fields": {
   "type": "string",
   "description": "Selector specifying which fields to include in a partial response.",
   "location": "query"
  },
  "key": {
   "type": "string",
   "description": "API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.",
   "location": "query"
  },
  "oauth_token": {
   "type": "string",
   "description": "OAuth 2.0 token for the current user.",
   "location": "query"
  },
  "prettyPrint": {
   "type": "boolean",
   "description": "Returns response with indentations and line breaks.",
   "default": "true",
   "location": "query"
  },
  "quotaUser": {
   "type": "string",
   "description": "Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. Overrides userIp if both are provided.",
   "location": "query"
  },
  "userIp": {
   "type": "string",
   "description": "IP address of the site where the request originates. Use this if you want to enforce per-user limits.",
   "location": "query"
  }
 },
 "auth": {
  "oauth2": {
   "scopes": {
    "https://www.googleapis.com/auth/email.migration": {
     "description": "Write access to Email Migration API v2."
    }
   }
  }
 },
 "schemas": {
   "Mail": {
    "id": "Mail",
    "type": "object",
    "description": "The metadata for a mail message.",
    "properties": {
     "isDraft": {
      "type": "boolean",
      "description": "The message is marked as a draft when migrated to the Gmail mailbox."
     },
     "isInbox": {
      "type": "boolean",
      "description": "The message should appear in the Inbox, regardless of its labels. By default, a migrated mail message will appear in the Inbox only if it has no labels."
     },
     "isSent": {
      "type": "boolean",
      "description": "The message is marked as \"Sent Mail\" when migrated to the Gmail mailbox."
     },
     "isStarred": {
      "type": "boolean",
      "description": "The message is starred when migrated."
     },
     "isTrash": {
      "type": "boolean",
      "description": "The message is marked as \"Trash\" when migrated."
     },
     "isUnread": {
      "type": "boolean",
      "description": "The message is marked as unread when migrated. Without this property, a migrated mail message is marked as read."
     },
     "isDeleted": {
      "type": "boolean",
      "description": "The message is migrated directly into Google Vault. Once archived in Google Vault, the message is only visible to a Vault administrator."
     },
     "labels": {
      "type": "array",
      "description": "The labels applied to the message when migrated.",
      "items": {
        "type": "string"
      }
     }
    }
   }
  },
  "resources": {
   "mail": {
    "methods": {
     "insert": {
      "id": "emailmigration.mail.insert",
      "path": "{userKey}/mail",
      "httpMethod": "POST",
      "description": "Insert a Mail resource into a user's Gmail account.",
      "parameters": {
       "userKey": {
        "type": "string",
        "description": "The email address or email alias of the user's mailbox to migrate the message to.",
        "required": true,
        "location": "path"
       }
      },
      "request": {
       "$ref": "Mail"
      },
      "scopes": [
       "https://www.googleapis.com/auth/email.migration"
      ],
      "supportsMediaUpload": true,
      "mediaUpload": {
       "accept": [
        "message/rfc822"
        ],
       "maxSize": "32MB",
       "protocols": {
        "simple": {
         "multipart": true,
         "path": "/upload/email/v2/users/{userKey}/mail"
        },
        "resumable": {
         "multipart": true,
         "path": "/upload/email/v2/users/{userKey}/mail"
        }
       }
      }
     }
    }
   }
  }
}
查看更多
小情绪 Triste *
3楼-- · 2019-08-28 14:20

The discovery document was slightly delayed from the actual release, but it's now available through the discovery service or directly here.

查看更多
登录 后发表回答