Code Guy
Code Guy

Reputation: 3198

People API returning error when bulkCreateContact is called

I have tried to bulk add a contact using API Try editor of Google 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"
}

I get the error as


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

Am I missing something?

Upvotes: 0

Views: 214

Answers (1)

ale13
ale13

Reputation: 6052

It looks like the 500 Internal Error message you are receiving is due to the fact that you are using the calendarUrls field in the request.

This might in fact be a bug so I have taken the opportunity to file a report on Google's Issue Tracker here.

I suggest you star the issue as all the updates will be posted there.

Upvotes: 1

Related Questions