Permission Error with REST API

Hello Community, I am new to ERPNEXT and I was playing with the integrated API. I can do almost all the CRUD, except the lists and filters. I have tried various forms seen here and elsewhere with no success.

I’m using Postman for the test.
Examples for filters:
—//HOST/api/resource/Country/?filters=[[“Country”,“name”,“=,“Argentina”]]—
—//HOST/api/resource/Country?filters=[[“Country”,“name”,”=,“Argentina”]]–
—//HOST/api/resource/Country?filters=[[“name”,“=,“Argentina”]]–
—//HOST/api/resource/Country?filters=[[“Country”,“name”,“like,”%Argentina%”]]–

Fields:
http://HOST/api/resource/Country?fields=[“name”,“code”]--

Name is default and I want to add code column,

Also
I want access to child table information for example the country.
For example:
http://HOST/api/resource/States?filters=[[“States”,“parent”,“=”,“mexico”]]
with error 403 FORBIDDEN

image

image
I know RPC exists but I need it with API REST.

Not one works.

If someone could help I would appreciate it a lot

Thanks

Very likely that the user you are querying from does not have permissions for the DocType “States”

1 Like

Hi @kOS,

I don’t know if you have been able to do this filtering. But I see in your filters are missing some quote " signs, particularly in the "=.
I see in the erpnext docs the example is using the doctype like the 2nd row.
But I tried the 3rd row also works.