Hi,
I am stuck trying make a Stock Entry via the REST API.
I am doing a POST call to http://192.168.1.162:8000/api/resource/Stock%20Entry with this json which is modelled on the results from a GET call to Stock Entry:
{
"data": {
"doctype": "Stock Entry",
"title": "Material Issue",
"from_warehouse": "Finished Goods - TC",
"company": "Test Company",
"purpose": "Material Issue",
"items": [
{
"transfer_qty": 22,
"basic_amount": 0,
"qty": 22,
"cost_center": "Main - TC",
"stock_uom": "Nos",
"item_name": "SC-25-S-BLK",
"amount": 0,
"actual_qty": 100,
"additional_cost": 0,
"conversion_factor": 1,
"docstatus": 1,
"uom": "Nos",
"basic_rate": 0,
"description": "SC-25-S-BLK",
"parent": "STE-00002",
"item_code": "SC-25-S-BLK",
"doctype": "Stock Entry Detail",
"expense_account": "Stock Adjustment - TC",
"allow_zero_valuation_rate": 0,
"s_warehouse": "Finished Goods - TC",
"parenttype": "Stock Entry",
"batch_no": "",
"valuation_rate": 0,
"parentfield": "items"
}
]
}
}
It returns this:
Server Error
Traceback (most recent call last):
File "/home/frappe/frappe-bench/apps/frappe/frappe/app.py", line 60, in application
response = frappe.api.handle()
File "/home/frappe/frappe-bench/apps/frappe/frappe/api.py", line 120, in handle
"data": frappe.get_doc(data).insert().as_dict()
File "/home/frappe/frappe-bench/apps/frappe/frappe/model/document.py", line 193, in insert
self._validate()
File "/home/frappe/frappe-bench/apps/frappe/frappe/model/document.py", line 399, in _validate
self._validate_mandatory()
File "/home/frappe/frappe-bench/apps/frappe/frappe/model/document.py", line 619, in _validate_mandatory
name=self.name))
MandatoryError: [Stock Entry, STE-00003]: items
Status: 417
which suggests there is something wrong with my items json but I think I’ve got all the mandatory fields so I’m not sure what I’m missing. I’ve tried removing almost all of the fields and lots of combinations of which fields are included.
Anybody have any clue as to what I’m doing wrong?
Thanks!