Api request fails with filters

Hi !
I’ve got a very annoying problem since updating to erpnext 10.1.20 frappe 10.1.21.
My API requests on children doctypes (namely Sales Order Item ans Purchase Order Item) fail if I apply a filter to it.
ex :
https://mydomain.com/api/resource/Sales Order Item?filters=[[“parent”,"=",“SO-EL-FR-04222”]]

renders :
Not Permitted
You do not have enough permissions to complete the action
Status: 403

log says :

Error handling request /api/resource/Sales%20Order%20Item?filters=%5B%5B%22parent%22,%22=%22,%22SO-EL-FR-04222%22%5D%5D&fields=%5B%22item_code%22,%22name%22,%22qty%22%5D&limit_start=0&limit_page_length=0&
Traceback (most recent call last):
File “/home/frappe/frappe-bench/env/local/lib/python2.7/site-packages/gunicorn/workers/sync.py”, line 135, in handle
self.handle_request(listener, req, client, addr)
File “/home/frappe/frappe-bench/env/local/lib/python2.7/site-packages/gunicorn/workers/sync.py”, line 176, in handle_request
respiter = self.wsgi(environ, resp.start_response)
File “/home/frappe/frappe-bench/env/local/lib/python2.7/site-packages/werkzeug/local.py”, line 228, in application
return ClosingIterator(app(environ, start_response), self.cleanup)
File “/home/frappe/frappe-bench/env/local/lib/python2.7/site-packages/werkzeug/wrappers.py”, line 301, in application
return f(*args[:-2] + (request,))(*args[-2:])
File “/home/frappe/frappe-bench/apps/frappe/frappe/app.py”, line 88, in application
response = handle_exception(e)
File “/home/frappe/frappe-bench/apps/frappe/frappe/app.py”, line 143, in handle_exception
if frappe.local.is_ajax or ‘application/json’ in frappe.get_request_header(‘Accept’):
TypeError: argument of type ‘NoneType’ is not iterable

It works if I request buy get https://mydomain.com/api/resource/Sales Order Item/0002d8613c

Request with filters do work on other doctypes.

I hope someone will have an idea to help me !
Thank yo !!

For filters the syntax is

https://mydomain.com/api/resource/Sales Order Item?filters=[["doctype",“parent”,"=", "parent_doc_name"]]

Thanks @saurabh6790, but unfortunately it doesn’t work either…

I don’t get it. In permission manager this doctype does not appear, I suppose permission is inherited from parent doctype. And I can access to specific item, it’s just filters…

Here’s the answer to this limitation:


and

1 Like

Based on sales order, Sales Order Item: Try this way,Syntax is, [https://{base_url}/api/resource/Doctype/serial_number], for example:[https://mydomain.com/api/resource/Sales Order/SO-EL-FR-04222]