Community
Showing results for 
Search instead for 
Do you mean 
Reply

400 bad request on PUT due to name conflict

Copper Contributor
Posts: 127
Country: Netherlands

400 bad request on PUT due to name conflict

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.",
"modelState": {
"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?

 

Greetings,

ACT Certified Consultants
TendenZ
the Netherlands
Employee
Posts: 240
Country: USA

Re: 400 bad request on PUT due to name conflict

Hi,

 

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?

 

Thanks!

Copper Contributor
Posts: 127
Country: Netherlands

Re: 400 bad request on PUT due to name conflict

[ Edited ]

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.

Greetings,

ACT Certified Consultants
TendenZ
the Netherlands
Employee
Posts: 240
Country: USA

Re: 400 bad request on PUT due to name conflict

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.

Copper Contributor
Posts: 127
Country: Netherlands

Re: 400 bad request on PUT due to name conflict

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.

Greetings,

ACT Certified Consultants
TendenZ
the Netherlands