API v1 to v2 upgrade POST activities http 400 responses

In v1 we can associate an activity with a person by passing a person_id in the POST request and v2 documentation states the same is possible, however, I get a 400 response when passing a person_id.

payload = {“subject”: “test”, “type”: “task”, “owner_id”: 21844844, “person_id”: 146680}

‘{“success”:false,“error”:“\\u0027person_id\\u0027 is a read-only field. Add a primary participant to set \\u0027person_id\\u0027 instead.”,“code”:“ERR_BAD_REQUEST”}’

Will “person_id” remain read only?

Hi p13guy

I don’t know if you managed to solve your problem, but I ran into the same issue and was able to fix it on my end.

The API documentation isn’t very clear about this, but when you create an activity and want to link it to a person, you shouldn’t use the “person_id” field in your payload — instead, you need to use the “participants” field.

You just have to include something like this in your payload:
{..., "participants": [ {"person_id": "1234", "primary": true} ], ...}

Be careful — it’s a bit tricky, because when you GET an activity, the field is shown as “primary_flag”, but when you POST, you must use the keyword “primary” only.

Hope this helps others and maybe encourages the Pipedrive devs to improve the documentation :wink:

Have a nice day!