Get Items from Sales Order

Hello everyone,

I have simple question about How to get sales orders item from Frappe API ?. I have got response from sales order except Sales order items.

with using this request :
http://206.189.54.106/api/resource/Sales%20Order?filters={"customer_name":"Baran Karaboga"}&fields=["naming_series","customer_name","order_type","address_display","total","net_total","delivery_date","delivery_status","billing_status"]&limit_page_length=20&

i got this response :

{
"data": [
    {
        "billing_status": "Not Billed",
        "delivery_date": "2099-01-01",
        "delivery_status": "Not Delivered",
        "net_total": 100,
        "customer_name": "Baran Karaboga",
        "naming_series": "SAL-ORD-.YYYY.-",
        "order_type": "Sales",
        "address_display": "asda<br>asdas<br>asdasd<br>\nasdasd<br>48200<br>Turkey<br>\nPhone: 05555598<br>Fax: 055555313498<br>Email: test@barankaraboga.com<br>",
        "total": 100
    },
    {
        "billing_status": "Not Billed",
        "delivery_date": "2099-01-01",
        "delivery_status": "Not Delivered",
        "net_total": 100,
        "customer_name": "Baran Karaboga",
        "naming_series": "SAL-ORD-.YYYY.-",
        "order_type": "Sales",
        "address_display": "asda<br>asdas<br>asdasd<br>\nasdasd<br>48200<br>Turkey<br>\nPhone: 5555553498<br>Fax: 05555598<br>Email: test@barankaraboga.com<br>",
        "total": 100
    }
]

}

this request works fine but i want to show items field. I have tried to add items in my query but i had always error like :

File “/home/frappe/frappe-bench/env/lib/python3.5/site-packages/pymysql/protocol.py”, line 220, in check_error\n err.raise_mysql_exception(self._data)\n File “/home/frappe/frappe-bench/env/lib/python3.5/site-packages/pymysql/err.py”, line 109, in raise_mysql_exception\n raise errorclass(errno, errval)\npymysql.err.InternalError: (1054, “Unknown column ‘items’ in ‘field list’”)

@barankaraboga

You can make custom API that.

@bhavikpatel7023 So there is no possibility to do that ? but items are field too, i should able to get them into do response.

I can’t help you with the API but I’ll tell you that cannot directly retrieve the items in Sales Order because that items table is a separate child doctype called Sales Order Items linked to the sales order via a field called Parent (so_items.parent = sales_order.name). You’ll have to query that table with correct Sales Order ID and you should be able to get the list.

-Did you find out how to get the child items from Sales Order?

I haven’t been able to get Sales Order Details, or Quotation Items, or any child table because

url/api/resource/Quotation%20Item

doesn’t work, but

url/api/resource/Quotation

does work, but it does not return its items