调用 bulkCreateContact 时 People API 返回错误

Posted

技术标签:

【中文标题】调用 bulkCreateContact 时 People API 返回错误【英文标题】:People API returning error when bulkCreateContact is called 【发布时间】:2021-10-30 17:09:56 【问题描述】:

我尝试使用 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"
      
    

我错过了什么吗?

【问题讨论】:

【参考方案1】:

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

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

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

【讨论】:

非常感谢。我真的很感激。由于您来自 Google,请不要介意尽快修复此错误。 在修复此问题后出现了另一个问题***.com/questions/69278944/…。你能提出这个问题吗?

以上是关于调用 bulkCreateContact 时 People API 返回错误的主要内容,如果未能解决你的问题,请参考以下文章

PE文件格式详解

PE文件结构 输入表

PE文件中的输入表

PE知识复习之PE的重定位表

PE知识复习之PE文件空白区添加代码

没有互联网连接时是不是调用“performFetchWithCompletionHandler”?