【问题标题】:People API returning error when bulkCreateContact is called调用 bulkCreateContact 时 People API 返回错误
【发布时间】:2023-03-23 10:18:01
【问题描述】:

我尝试使用 Google 的 API Try 编辑器 https://developers.google.com/people/api/rest/v1/people/batchCreateContacts 批量添加联系人

{
  "contacts": [
    {
      "contactPerson": {
        "addresses": [
          {
            "formattedValue": "formattedValue",
            "type": "type",
            "poBox": "poBox",
            "streetAddress": "streetAddress",
            "extendedAddress": "extendedAddress",
            "region": "region",
            "postalCode": "postalCode",
            "country": "country",
            "countryCode": "countryCode"
          },
          {
            "formattedValue": "formattedValue",
            "type": "type",
            "poBox": "poBox",
            "streetAddress": "streetAddress",
            "extendedAddress": "extendedAddress",
            "city": "city",
            "region": "region",
            "postalCode": "postalCode",
            "country": "country",
            "countryCode": "countryCode"
          }
        ],
        "biographies": [
          {
            "value": "biographies-value",
            "contentType": "TEXT_PLAIN"
          }
        ],
        "birthdays": [
          {
            "date": {
              "year": 1988,
              "month": 9,
              "day": 22
            },
            "text": "22/09/1988"
          }
        ],
        "calendarUrls": [
          {
            "url": "https://lh3.googleusercontent.com/ogw/ADea4I4kLm9hsAYNpD_7v-7wXki3joED-eg2ZHcGmp31",
            "type": "calendarUrls-type"
          }
        ],
        "clientData": [
          {
            "key": "clientData-key",
            "value": "clientData-value"
          }
        ],
        "emailAddresses": [
          {
            "value": "emailAddresses-value",
            "type": "emailAddresses-type",
            "displayName": "emailAddresses-displayName"
          }
        ],
        "events": [
          {
            "date": {
              "year": 1988,
              "month": 9,
              "day": 22
            },
            "type": "events-type"
          },
          {
            "date": {
              "year": 1988,
              "month": 9,
              "day": 22
            },
            "type": "events-type"
          },
          {
            "date": {
              "year": 2019,
              "month": 12,
              "day": 7
            },
            "type": "marriage"
          }
        ],
        "externalIds": [
          {
            "value": "externalIds-value",
            "type": "externalIds-type"
          }
        ],
        "fileAses": [
          {
            "value": "fileAses-value"
          }
        ],
        "genders": [
          {
            "value": "male",
            "addressMeAs": "her"
          }
        ],
        "imClients": [
          {
            "username": "imClients-username1",
            "type": "imClients-typeA",
            "protocol": "imClients-protocol1"
          },
          {
            "username": "imClients-username2",
            "type": "imClients-typeA",
            "protocol": "imClients-protocol2"
          },
          {
            "username": "imClients-username3",
            "type": "imClients-typeB",
            "protocol": "imClients-protocol3"
          }
        ],
        "interests": [
          {
            "value": "interests-value"
          }
        ],
        "locales": [
          {
            "value": "locales-value"
          }
        ],
        "locations": [
          {
            "value": "locations-value1",
            "type": "desk",
            "current": true,
            "buildingId": "locations-buildingId",
            "floor": "locations-floor",
            "floorSection": "buildingId-floorSection",
            "deskCode": "locations-deskCode"
          },
          {
            "value": "locations-value2",
            "type": "desk",
            "current": true,
            "buildingId": "locations-buildingId",
            "floor": "locations-floor",
            "floorSection": "buildingId-floorSection",
            "deskCode": "locations-deskCode"
          }
        ],
        "memberships": [
          {
            "contactGroupMembership": {
              "contactGroupResourceName": "contactGroups/3616ed318c1125e3"
            }
          }
        ],
        "miscKeywords": [
          {
            "value": "SENSITIVITY1",
            "type": "OUTLOOK_SENSITIVITY"
          },
          {
            "value": "SENSITIVITY2",
            "type": "OUTLOOK_SENSITIVITY"
          },
          {
            "value": "OUTLOOK_SUBJECT",
            "type": "OUTLOOK_SUBJECT"
          },
          {
            "value": "OUTLOOK_BILLING_INFORMATION",
            "type": "OUTLOOK_BILLING_INFORMATION"
          },
          {
            "value": "OUTLOOK_DIRECTORY_SERVER",
            "type": "OUTLOOK_DIRECTORY_SERVER"
          },
          {
            "value": "OUTLOOK_KEYWORD",
            "type": "OUTLOOK_KEYWORD"
          },
          {
            "value": "OUTLOOK_MILEAGE",
            "type": "OUTLOOK_MILEAGE"
          },
          {
            "value": "OUTLOOK_PRIORITY",
            "type": "OUTLOOK_PRIORITY"
          },
          {
            "value": "OUTLOOK_SUBJECT",
            "type": "OUTLOOK_SUBJECT"
          },
          {
            "value": "OUTLOOK_USER1-value",
            "type": "OUTLOOK_USER"
          },
          {
            "value": "OUTLOOK_USER2-value",
            "type": "OUTLOOK_USER"
          },
          {
            "value": "HOME",
            "type": "HOME"
          },
          {
            "value": "WORK",
            "type": "WORK"
          },
          {
            "value": "OTHER",
            "type": "OTHER"
          }
        ],
        "names": [
          {
            "unstructuredName": "unstructuredName",
            "familyName": "MrTest",
            "givenName": "givenName",
            "middleName": "middleName",
            "honorificPrefix": "honorificPrefix",
            "honorificSuffix": "honorificSuffix",
            "phoneticFullName": "phoneticFullName",
            "phoneticFamilyName": "phoneticFamilyName",
            "phoneticGivenName": "phoneticGivenName",
            "phoneticMiddleName": "phoneticMiddleName",
            "phoneticHonorificPrefix": "phoneticHonorificPrefix",
            "phoneticHonorificSuffix": "phoneticHonorificSuffix"
          }
        ],
        "nicknames": [
          {
            "value": "nicknames-value-alternate-name",
            "type": "ALTERNATE_NAME"
          },
          {
            "value": "nicknames-value-default",
            "type": "DEFAULT"
          }
        ],
        "occupations": [
          {
            "value": "occupations-value"
          }
        ],
        "organizations": [
          {
            "type": "organizations-type",
            "startDate": {
              "year": 1988,
              "month": 9,
              "day": 22
            },
            "endDate": {
              "year": 1988,
              "month": 9,
              "day": 22
            },
            "current": true,
            "name": "organizations-name",
            "phoneticName": "organizations-phoneticName",
            "department": "organizations-department",
            "title": "organizations-title",
            "jobDescription": "organizations-jobDescription",
            "symbol": "organizations-symbol",
            "domain": "organizations-domain",
            "location": "organizations-location"
          }
        ],
        "phoneNumbers": [
          {
            "value": "phoneNumbers-value",
            "type": "phoneNumbers-type"
          }
        ],
        "relations": [
          {
            "person": "relations-person",
            "type": "relations-type"
          }
        ],
        "sipAddresses": [
          {
            "value": "sipAddresses-value",
            "type": "sipAddresses-type"
          }
        ],
        "urls": [
          {
            "value": "https://lh3.googleusercontent.com/ogw/ADea4I4kLm9hsAYNpD_7v-7wXki3joED-eg2ZHcGmp31",
            "type": "urls-type"
          }
        ],
        "userDefined": [
          {
            "key": "userDefined-key",
            "value": "userDefined-value"
          }
        ]
      }
    }
  ],
  "readMask": "emailAddresses,phoneNumbers,addresses,birthdays,biographies,calendarUrls,clientData,coverPhotos,events,externalIds,genders,imClients,interests,locales,locations,memberships,miscKeywords,names,nicknames,occupations,organizations,phoneNumbers,photos,relations,sipAddresses,skills,urls,userDefined"
}

我得到的错误是


    {
      "error": {
        "code": 500,
        "message": "Internal error encountered.",
        "status": "INTERNAL"
      }
    }

我错过了什么吗?

【问题讨论】:

    标签: google-people-api


    【解决方案1】:

    您收到的500 Internal Error 消息似乎是由于您在请求中使用了calendarUrls 字段。

    这实际上可能是一个错误,因此我借此机会在 Google 的问题跟踪器 here 上提交报告。

    我建议您在此问题上加注星标,因为所有更新都会在此处发布。

    【讨论】:

    • 非常感谢。我真的很感激。由于您来自 Google,请不要介意尽快修复此错误。
    • 在修复此问题后出现了另一个问题stackoverflow.com/questions/69278944/…。你能提出这个问题吗?
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2016-10-27
    • 2015-05-16
    • 2021-04-11
    • 2017-02-10
    • 2019-06-19
    • 2017-06-25
    • 2017-04-14
    相关资源
    最近更新 更多