Frappe get_doc not working

I have created an API method as below

@frappe.whitelist()
def createFarm(company):
#Create New Farm
new_farm = frappe.get_doc({
“doctype”: “Farm”,
“name”: company,
“company”: company
})
try:
new_farm.insert()
return new_farm.name
except Exception as err:
return err

when i pass an existing company like below

http://127.0.0.1:8000/api/method/fish_farm.api.createFarm?company=Upande%20LTD

the output is as follows

// 20171122101730
// http://127.0.0.1:8000/api/method/fish_farm.api.createFarm?company=Upande%20LTD

{
“message”: “Upande LTD”
}

when i refresh the api resource Farm the array doesn’t reflect the new Farm record, it is as if it is not saved into the database

// 20171122101733
// http://127.0.0.1:8000/api/resource/Farm

{
“data”: Array[0][

]
}

Post this on: discuss.frappe.io