Discussions
Staff.json returns gives 500 error
Hi,
When we try to post to the 'staff.json' API endpoint we often get returned a 500 Internal Server error from ServiceM8. We are posting the following fields: active, first, last, email, mobile, job_title and security_role_uuid.
We are authorising using basic auth. Often we will get returned the 500 Error for the first 1 or 2 tries, then it will subsequently work as needed.
In recent cases I have tried 8 or 10 times before giving up. The exact error being returned is as follows:
Server error: POST https://api.servicem8.com/api_1.0/staff.json
resulted in a 500 Internal Server Error
response:
{"errorCode":500,"message":"Internal Server Error"}
UTC timestamps for examples of this are: 2019-08-07 08:00:44, 2019-08-07 08:09:13, 2019-08-07 08:09:28, 2019-08-07 08:52:38.
Hope this can be rectified
Cheers
Hi Joe,
We've been able to investigate the cause of the error thanks to the timestamps - the reason is the email being provided in the record already exists in the same account (or another ServiceM8 account).
You could submit the staff record without an email address and this would succeed, or switch to an email address not in use.
Our team will update the error message for the API so it correctly returns an error code when the email provided already exists.
Cheers,
Ben
ο»Ώ