Error when try to get doctype via API

I try to get json via api, with these url:

http://localhost:8000/api/resource/cidade?fields=["name",%20"descricao",%20"uf"]

Works fine, I got these:

{"data":[{"uf":"GO","name":"CID5433","descricao":"ABADIA DE GOI\u00c1S -"},{"uf":"MG","name":"CID2441","descricao":"ABADIA DOS DOURADOS"},{"uf":"GO","name":"CID5462","descricao":"ABADI\u00c2NIA"},{"uf":"MG","name":"CID2491","descricao":"ABAET\u00c9"},{"uf":"PA","name":"CID0217","descricao":"ABAETETUBA"},{"uf":"CE","name":"CID1069","descricao":"ABAIARA"},{"uf":"BA","name":"CID2066","descricao":"ABA\u00cdRA"},{"uf":"BA","name":"CID1859","descricao":"ABAR\u00c9"},{"uf":"PR","name":"CID4086","descricao":"ABATI\u00c1"},{"uf":"SC","name":"CID4455","descricao":"ABDON BATISTA"},{"uf":"PA","name":"CID0262","descricao":"ABEL FIGUEIREDO"},{"uf":"SC","name":"CID4370","descricao":"ABELARDO LUZ"},{"uf":"MG","name":"CID2972","descricao":"ABRE CAMPO"},{"uf":"PE","name":"CID1638","descricao":"ABREU E LIMA"},{"uf":"TO","name":"CID0354","descricao":"ABREUL\u00c2NDIA"},{"uf":"MG","name":"CID2954","descricao":"ACAIACA"},{"uf":"MA","name":"CID0546","descricao":"A\u00c7AIL\u00c2NDIA"},{"uf":"BA","name":"CID2004","descricao":"ACAJUTIBA"},{"uf":"PA","name":"CID0224","descricao":"ACAR\u00c1"},{"uf":"CE","name":"CID0956","descricao":"ACARAPE"}]}

But when I try:

http://localhost:8000/api/resource/cidade/CID5433/

To get “CID5433” data, I got these error:

Traceback (innermost last):
  File "/Users/fellipeh/Developer/frappe/apps/frappe/frappe/app.py", line 72, in application
    response = frappe.api.handle()
  File "/Users/fellipeh/Developer/frappe/apps/frappe/frappe/api.py", line 73, in handle
    doc = frappe.get_doc(doctype, name)
  File "/Users/fellipeh/Developer/frappe/apps/frappe/frappe/__init__.py", line 525, in get_doc
    return frappe.model.document.get_doc(arg1, arg2)
  File "/Users/fellipeh/Developer/frappe/apps/frappe/frappe/model/document.py", line 43, in get_doc
    controller = get_controller(doctype)
  File "/Users/fellipeh/Developer/frappe/apps/frappe/frappe/model/base_document.py", line 38, in get_controller
    raise ImportError, doctype
 ImportError: cidade

Any tips?

Seems issue due to exrtra ‘/’ after docname.

Try with http://localhost:8000/api/resource/cidade/CID5433

I tried that before send this post… same error…

Make sure you use the correct case “Cidade” or cidade

Same error…

I try: http://localhost:8000/api/resource/cidade and show me all my records, including CID0001… this is the results:

{“data”:[{“name”:“CID0001”}]}

when I try: http://localhost:8000/api/resource/cidade/CID0001 show me this error:

Traceback (innermost last):
  File "/Users/fellipeh/Developer/frappe/apps/frappe/frappe/app.py", line 72, in application
    response = frappe.api.handle()
  File "/Users/fellipeh/Developer/frappe/apps/frappe/frappe/api.py", line 73, in handle
    doc = frappe.get_doc(doctype, name)
  File "/Users/fellipeh/Developer/frappe/apps/frappe/frappe/__init__.py", line 525, in get_doc
    return frappe.model.document.get_doc(arg1, arg2)
  File "/Users/fellipeh/Developer/frappe/apps/frappe/frappe/model/document.py", line 43, in get_doc
    controller = get_controller(doctype)
  File "/Users/fellipeh/Developer/frappe/apps/frappe/frappe/model/base_document.py", line 38, in get_controller
    raise ImportError, doctype
 ImportError: cidade