I have this request:
https://{host}/api/resource/Item/Gloves-Variant-1
which returns something like this:
{
"data": {
...,
"barcodes": [
{ ... }
],
"reorder_levels": [],
"uoms": [
{ ... }
],
"attributes": [
{ ... }
],
"item_defaults": [
{ ... }
],
"supplier_items": [
{ ... }
],
"customer_items": [],
"taxes": [],
"website_item_groups": [],
"website_specifications": []
}
}
However, when I make this call:
https://{host}/api/resource/Item?filters=[[“variant_of”,“=”,“Gloves”]]&fields=[“*”]
I don’t see barcodes
, attributes
, and other fields that are objects in the response. only string/bool/int fields. Is there a way I can include those in the response?
Furthermore, requesting:
https://{host}/api/resource/Item?filters=[[“variant_of”,“=”,“Gloves”]]&fields=[“attributes”]
returns
500 INTERNAL SERVER ERROR
with the following body:
Traceback (most recent call last):
File "/home/frappe/benches/bench-version-12-2020-02-24/apps/frappe/frappe/app.py", line 60, in application
response = frappe.api.handle()
File "/home/frappe/benches/bench-version-12-2020-02-24/apps/frappe/frappe/api.py", line 120, in handle
doctype, **frappe.local.form_dict)})
File "/home/frappe/benches/bench-version-12-2020-02-24/apps/frappe/frappe/__init__.py", line 1051, in call
return fn(*args, **newargs)
File "/home/frappe/benches/bench-version-12-2020-02-24/apps/frappe/frappe/client.py", line 35, in get_list
limit_start=limit_start, limit_page_length=limit_page_length, ignore_permissions=False)
File "/home/frappe/benches/bench-version-12-2020-02-24/apps/frappe/frappe/__init__.py", line 1287, in get_list
return frappe.model.db_query.DatabaseQuery(doctype).execute(None, *args, **kwargs)
File "/home/frappe/benches/bench-version-12-2020-02-24/apps/frappe/frappe/model/db_query.py", line 96, in execute
result = self.build_and_run()
File "/home/frappe/benches/bench-version-12-2020-02-24/apps/frappe/frappe/model/db_query.py", line 130, in build_and_run
return frappe.db.sql(query, as_dict=not self.as_list, debug=self.debug, update=self.update)
File "/home/frappe/benches/bench-version-12-2020-02-24/apps/frappe/frappe/database/database.py", line 171, in sql
self._cursor.execute(query)
File "/home/frappe/benches/bench-version-12-2020-02-24/env/lib/python3.6/site-packages/pymysql/cursors.py", line 170, in execute
result = self._query(query)
File "/home/frappe/benches/bench-version-12-2020-02-24/env/lib/python3.6/site-packages/pymysql/cursors.py", line 328, in _query
conn.query(q)
File "/home/frappe/benches/bench-version-12-2020-02-24/env/lib/python3.6/site-packages/pymysql/connections.py", line 517, in query
self._affected_rows = self._read_query_result(unbuffered=unbuffered)
File "/home/frappe/benches/bench-version-12-2020-02-24/env/lib/python3.6/site-packages/pymysql/connections.py", line 732, in _read_query_result
result.read()
File "/home/frappe/benches/bench-version-12-2020-02-24/env/lib/python3.6/site-packages/pymysql/connections.py", line 1075, in read
first_packet = self.connection._read_packet()
File "/home/frappe/benches/bench-version-12-2020-02-24/env/lib/python3.6/site-packages/pymysql/connections.py", line 684, in _read_packet
packet.check_error()
File "/home/frappe/benches/bench-version-12-2020-02-24/env/lib/python3.6/site-packages/pymysql/protocol.py", line 220, in check_error
err.raise_mysql_exception(self._data)
File "/home/frappe/benches/bench-version-12-2020-02-24/env/lib/python3.6/site-packages/pymysql/err.py", line 109, in raise_mysql_exception
raise errorclass(errno, errval)
pymysql.err.InternalError: (1054, "Unknown column 'attributes' in 'field list'")