0

API connection error

mark 2 years ago updated 2 years ago 10

I'm curious. On October 28, one of our API connections stopped working. Not all of them, but one of them returns an 500 Internal Server Error.


1) @XTRF, where there any changes made on October 28 that could have impacted our API?

2) Anyone else, did this happen to you? Or is this an isolated issue?


Thanks!

+1

If I had to guess you are getting this when trying to create a new client contact yeah? like a POST to /home-api/customers/persons, yeah? I'd almost bet 100% that's when you're seeing this.


Turns out that in a recent update the API was changed, documentation does not indicate what fields are required anyway, but it was not updated in the example to indicate that this was required, and I don't remember seeing anything in release notes. 

Anyway, the solution (if this is where you're seeing it) is to add "motherTonguesIds": [] to the body of the call. So it can be empty, but has to be present apparently.  I added that and everything works now.

If it is not this call, can you let us know which call is erorring? Might be another similar one out there.

@XTRF, I think this would be a good time to mention again that error handling in the API could be vastly upgraded so that more details such as "missing required field: motherTonguesIds" or something. It is inefficient for both your team and ours I think to do troubleshooting on our own or have to put in bug tickets every time. Thanks!

So something like this:

{
   "active": true,

   "motherTonguesIds": [],

   "name": "Thaddeus",
   "lastName": "Test",
   "customerId": 223,
   "contact": {
      "phones": ["123-456-7890"],
      "emails":

         { "primary": "sometest.test@test.org" }

   }
}

Cori, this addressed my issues. Thanks for the help.

And the credit on this one goes to Miroslaw and the XTRF support team. I didn't figure it out. I put in a ticket with my log (do you know how to access your logs? They can be helpful). The log indicated whenever this was called there was a null  pointer exception. I just couldn't figure out where or why all of a sudden. Miroslaw got me the answer within a day, and we were back on the road. Took a while for me to realize there was even a problem though because the error handling is so vague.

I don't know how to access my logs.  I will need to look into this.


And I also took time to address this because there were no specifics in the errors. So I assume it was related to human error of some sort. I'm going to jump on this asap.


Thanks!

Thanks for sharing this URL to view the logs!

Have not had the issue you described, as we don't run these kind of API actions.

Super helpful!

That is the error that I'm finding. I'm going to give this a try. Thanks so much.

Mark: On 26th there was an update of your instance from 8.0 to 8.1, that's the reason why the issue appeared on 28th.

We have also discovered another problem resulting in 500 error, related to the way passwords are hashed in the database. If you authenticate your API requests using Basic auth with login+password, you have to either migrate to access tokens (preferred) or login at least once with the API user to home portal.