Hello,
Always Doctype field data will be return into response of rest api but here when you checked response data which are below are totally different from File doctype.
Request : http://192.168.123.72:8000/api/method/run_custom_method?cmd=uploadfile&doctype=Item&docname=Test%20Item%20%201&filename=api.txt&filedata=SGVsbG8gV29ybGQ=&from_form=1
Resposne : {“message”:{“comment”:{“ref_doctype”:“Item”,“modified_by”:“Administrator”,“name”:“8f3cf8f01b”,“parent”:null,“creation”:“2018-01-16 21:33:11.137426”,“modified”:“2018-01-16 21:33:11.137426”,“doctype”:“Version”,“idx”:0,“parenttype”:null,“docname”:“Test Item 1”,“owner”:“Administrator”,“docstatus”:0,“data”:“{\n “comment”: “added api2e3fe5.txt”, \n “comment_type”: “Attachment”\n}”,“parentfield”:null},“file_name”:“api2e3fe5.txt”,“file_url”:“/files/api2e3fe5.txt”,“name”:“7cf844481c”,“is_private”:0}}
Below are the response when you get data from particular file name. Checked both response are different.
Request : http://192.168.123.72:8000/api/resource/File/b458a51aae
Response : {“data”:{“attached_to_name”:“UPS”,“file_name”:“test1.txt”,“creation”:“2018-01-15 15:47:07.700383",“doctype”:“File”,“lft”:131,“is_attachments_folder”:0,“is_folder”:0,“file_size”:613,“owner”:"harsh.mehta@augustinfotechteam.com”,“content_hash”:“e0559d0ae32c0f58035b6c1e735cbab7”,“modified_by”:"harsh.mehta@augustinfotechteam.com",“is_home_folder”:0,“docstatus”:0,“folder”:“Home/Attachments”,“attached_to_doctype”:“Item”,“rgt”:132,“is_private”:1,“name”:“b458a51aae”,“idx”:0,“file_url”:“/private/files/test1.txt”,“modified”:“2018-01-15 15:47:07.720506”,“old_parent”:“Home/Attachments”}}
The above response are perfect. So when we use rest api to insert file into ERP above result should be return but it not seems like that.