03-20-2018 08:13 AM
I've encountered some strangeness in the PUT request of a contact.
I only did a request of the contact based on ID, then changed a fields value (had nothing to do with the name, it was an ExactOnline contact id).
Then I posted back the contact to save it. It gave me back:
"message": "The request is invalid.",
"middleName": ["The middleName 'P.' conflicts with the fullName: Lauren Ingram"]
Okay, I understand this, but that was already the case in Act!!! (see attachment) I didn't change the name! It surely cannot be the case that we have to check the name correctness before each POST, is it?
03-20-2018 10:35 AM
Can you clarify if you are issuing a PUT or POST, as you mentioned both, and they are very different. POST will create a new contact, while PUT is meant to update a contact in whole. As a side note, if you are only updating one field, PATCH is much more succinct (as you only pass the changed field).
If, you are doing a PUT, can you validate that you passed in the same name values that you received via GET?
03-21-2018 01:05 AM - edited 03-21-2018 01:08 AM
Hi Xavier, it's a PUT. The last line in my first post said "... before each POST..." but of course I meant PUT (like in the rest of the post).
And yes, the object is first fetched via a GET request, one field is changed and it is PUT-ed back so all the name parts are the same.
I know that for one field a PATCH is more logical to use, but in this case in my Exact/Act sync application it can be that also other fields are set other than that Exact ID field.. and I don't know at that point which fields are actually changed and which are the same.. for that I would have to check each field/value combination first, determine which fields are changed and then build a PATCH request. So I was pragmatic and chose for a PUT, which should be - in this case - no problem.
03-21-2018 09:08 AM
Thanks for that.
We've looked at the both the API and Act!, and actually not seeing a way that one can add a middle name that's not part of a full name. The error you're seeing from the API is actually correct: you should not be able to update a contact and include a middle name that isn't part of the full name, the same goes for Act!. The only way we were able to see what you are seeing is to manually update the full name in the database. Is your data already "corrupt" in the database, in the sense that you have contacts with name parts that are not part of the full name? That would explain the behavior you are seeing, we don't let you save it back again that way. We're struggling to identify how one might end up in this state.
03-28-2018 03:38 AM
Hi Xavier, no I didn't every manually edit the database records.
They have to be edited/inserted somehow that way by the API.
Very strange indeed.