mailjet / mailjet-apiv3-php

[API v3] Mailjet PHP Wrapper
http://dev.mailjet.com
MIT License
263 stars 86 forks source link

How to attach properties to a contact? #245

Closed Ops-Oliver closed 2 years ago

Ops-Oliver commented 2 years ago

Hello,

I`m trying to upload contact properties via the endpoint /contact/managemanycontacts.

This is the Postman-POST-request I send to this endpoint:

{
   "Contacts":[
      {
         "Name":"Paul Test",
         "Email":"paul@test.de",
         "Properties":[
            {
               "Name":"vorname",
               "Value":"TESTTEST"
            }
         ],
         "IsExcludedFromCampaigns":"false"
      }
   ],
   "ContactsLists":[
      {
         "Action":"addnoforce",
         "ListID":"61309"
      }
   ]
}

When I look into the job via the endpoint /contact/managemanycontacts/{JobID} I get the error message 'property not defined'. But the property is defined. I checked it via the /contactmetadata - endpoint.

How do I need to hand over the property fields? I didnt found anything useful in the API documentation. I used this as my resource. Maybe atleast one example of a contact being added with properties would be great in the documentation. 😊

Thanks in advance for the help.

Ops-Oliver commented 2 years ago

For anyone who stumbles across this question:

The solution is to hand the properties over like this: [propertyname]:[propertyvalue]

     "Properties":
        {
           "vorname":"Test", 
           "nachname":"TestNachname"
        },