Update a Lead is not working!

Hi!

I’m trying to update the owner of my leads using the PATCH method and the next url according to the documentation:

https://{company_name}.pipedrive.com/api/v1/leads/{id}/?api_token={api_token}&owner_id={owner_id}

The response is 200 but the lead owner is not updated. In the response content the owner_id doesn’t change either

Help Please

Hey @DavidLopez
Thanks for sharing the details. From the looks of it, you seem to be passing owner_id as a query parameter and not as part of the request body. Can you pass it in the request body as a JSON with content-type header set to application/json ?

Let me know if I am missing something?

Hi @Hem!

Know I’m trying to link a lead to a person. But I receive a 404 response and a “Not Found” content.

I’m using the PATH method with python:

lead_update = f"https://{company_name}.pipedrive.com/api/v1/leads/?id=532c0b40-3913-11ec-90e4-e5e59deb1413&api_token={api_token}"

headers = {'Content-type': 'application/json'}

body= {"person_id": 3773}

r = requests.patch(url, data=json.dumps(data), headers=headers)

I can GET the lead by it’s UUID ID, and I can GET the person by it’s ID. I don’t understand why I can’t update the lead.

Can you help me with that?

Hi @DavidLopez
thanks for sharing the snippet.

I see that the issue is a result of passing ID as a query parameter. Can you change

https://{company_name}.pipedrive.com/api/v1/leads/?id=532c0b40-3913-11ec-90e4-e5e59deb1413&api_token={api_token}

to

https://{company_name}.pipedrive.com/api/v1/leads/532c0b40-3913-11ec-90e4-e5e59deb1413&api_token={api_token}