【问题标题】:Discovery Document for Google Email Migration API v2?Google 电子邮件迁移 API v2 的发现文档?
【发布时间】:2023-03-11 10:55:01
【问题描述】:

今天,Google announced 推出了新版本的电子邮件迁移 API。 API 似乎遵循 Google 的正常 REST 格式,但我无法确定 API 的服务名称和版本信息,以便将其与 google-api-python-client 一起使用。

是否有新 API 的发现文档,如果有,服务名称和版本是什么?

【问题讨论】:

    标签: gmail google-apps google-admin-sdk google-email-migration


    【解决方案1】:

    发现文档与实际发布相比略有延迟,但现在可以通过discovery service 或直接通过here 获得。

    【讨论】:

      【解决方案2】:

      目前,我已经能够编写自己的non-standard discovery document。它可能有问题/不完整,但它适用于我的测试消息和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"
              }
             }
            }
           }
          }
         }
        }
      }
      

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2015-06-24
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2011-01-21
        • 1970-01-01
        相关资源
        最近更新 更多