'Google People API Creating a contact - Issue with "organization"

I am pretty new to programming and trying to create contacts (source: Excel) and send them to Google Contacts, using the People API. My code works fine but I am having an issue maping the organization (company) to the specific person. The documentation mentions that "organizations" should be the correct way to pass on the information to the People API, but whenever I try this I get: "HttpError 400" - "Invalid JSON payload received. Unknown name "value" at 'person.organizations[0]': Cannot find field."

Would appreciate any help, thanks!

https://developers.google.com/people/api/rest/v1/people/createContact

SCOPES = ['https://www.googleapis.com/auth/contacts']
data = pd.read_excel(r"\\NAS\PPA Daten\01 ppa\01 7 Kontakte\Kontaktliste_Masterfile.xlsx",na_filter=False)
df = pd.DataFrame(data,columns=["First Name","Last Name","Organization","E-mail Address","E-mail 2 Address","Home Phone","Business Phone","Mobile Phone","Notiz für Kontaktexport"])

def main():

    creds = None
    if os.path.exists('token.pickle'):
        with open('token.pickle', 'rb') as token:
            creds = pickle.load(token)
    # If there are no (valid) credentials available, let the user log in.
    if not creds or not creds.valid:
        if creds and creds.expired and creds.refresh_token:
            creds.refresh(Request())
        else:
            flow = InstalledAppFlow.from_client_secrets_file(
                'credentials.json', SCOPES)
            creds = flow.run_local_server(port=0)
        # Save the credentials for the next run
        with open('token.pickle', 'wb') as token:
            pickle.dump(creds, token)

    service = build('people', 'v1', credentials=creds)

    # CREATING CONTACTS

    for _, row in df.iterrows():
            service.people().createContact(body={

                "names": [

                        {"givenName": row["First Name"],

                        "familyName": row["Last Name"]}

                ],

                "phoneNumbers": [

                        {'value': str(row["Home Phone"])},

                        {'value': str(row["Business Phone"])},

                        {'value': str(row["Mobile Phone"])}

                ],
                "emailAddresses": [
                    {
                        'value': row["E-mail Address"]
                    }
                ],
                "biographies": [
                    {
                        "value": row["Notiz für Kontaktexport"]
                    }
                ],
                "organizations": [
                    {
                        "value": "test"
                    }
                ]
            }).execute()

            time.sleep(0.5)

if __name__ == '__main__':
    main()


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source