idPropery in PATCH not working in v3

Getting a response status code of 404 with no status text.

import requestsimport jsonfilename = "C:\\Salient\\SalientETL\\Projects\\Glorious\Output\\NS_PAYLOAD_Deals.txt"with open(filename) as f: content = f.readlines()for line in content: headers = { 'accept': "application/json", 'content-type': "application/json" } url = "https://api.hubapi.com/crm/v3/objects/deals" querystring = {"idProperty":"dealname","hapikey": "xxx"} payload = json.loads(line) ##print(payload) response = requests.request("PATCH", url, data=payload, headers=headers, params=querystring) print(response.text) print(response.status_code)

I want to be abe to update records by the dealname property if possible. This would be much easier and preferred over supplying the DealID. Is there a reason why the dealname property is not allowed? Does the field need to be defined as a unique field? This is a hs defined field, so I can’t edit the field. Can you please explain how we can use the idProperty with the PATCH method?

------------------------------------------------------------------

Source data:

“{\“properties\”:{\“dealname\”:\“Green Pharm - 2021-06-30\”,\“dealstage\”:\“closedwon\”,\“amount\”:\“2600.00\”,\“closedate\”:\“2021-06-30\”,\“market\”:\“Medical\”,\“leaflink_order_no\”:\“9543be86\”}}”
“{\“properties\”:{\“dealname\”:\“Green Pharm - Bay City - AU - 2021-06-30\”,\“dealstage\”:\“closedwon\”,\“amount\”:\“3250.00\”,\“closedate\”:\“2021-06-30\”,\“market\”:\“Adult Use\”,\“leaflink_order_no\”:\“9543be96\”}}”

------------------------------------------------------------------

405

Process finished with exit code 0

@GBeckwith

Going out on a limb and saying that your suspicion is correct. The deal name is not necessarily unique so cannot be guaranteed to be updating the correct record.

You could create a custom property that is unique and use that. Could probably automate it, but you would have to ensure that the enduser only uses unique names.

@lynton , let me know if I am barking up the worng tree here.

Since I could not get the idProperty to work, I ended up having to pass the dealID in the url string.

url = "https://api.hubapi.com/crm/v3/objects/deals/{}".format(dealID)querystring = {"hapikey": "xxxx"}payload = json.loads(line[10:])response = requests.request("PATCH", url, data=payload, headers=headers, params=querystring)

Please reply to this thread if someone is able to successfully patch a deal via the idProperty feature. I would rather go that route and may change my scripting.