[solved] "PUT" request is failing - 500 internal server error

I am able to perform GET, POST, DELETE ajax requests but i get a 500 internal server error when executing a PUT request

type: “PUT”,
crossDomain: true,
url: ‘/api/resource/Feed Stock/FS00002’,
headers: {“X-Frappe-CSRF-Token”:p_token},
data: {“data”: JSON.stringify({“total_cost”:1500})}, //stringify JSON object.
success: function(resp)
notification = ‘Total Cost has been updated’
setTimeout(Notify(notification, ‘success’), 36000)
error: function(err){
Notify(err.statusText, ‘danger’)

For details look in the logs for a traceback, once you know that search the forum for what to do next - you will likely find a post with the answer you seek

Hi @clarkej i am using bench start at the moment and there isnt a lot of info helpful to debug.

i have found the solution you must pass the whole doctype data for the PUT request to work i.e doctype, name, child table data(if you have) and the data you want to update

‘{“doctype”:“Feed Stock”,“name”:’+‘"’+data[‘parent’]+‘"’+‘,“total_cost”:’+‘"’+total_cost+‘"’+‘,“items”:’+‘[’+items+‘]’+‘}’