Listing resources using API

Hi Experts,

I call a API:

 http://ericsson-dbss.com:8000/api/resource/spms.hardware_management_system.doctype.vendor

But it gives error:

{
    "exc_type": "DoesNotExistError",
    "_server_messages": "[\"{\\\"message\\\": \\\"DocType spms.hardware_management_system.doctype.vendor not found\\\", \\\"title\\\": \\\"Message\\\", \\\"indicator\\\": \\\"red\\\", \\\"raise_exception\\\": 1, \\\"__frappe_exc_id\\\": \\\"41517f32dbde5e98bbdeaf0f657e6e0d008efe18feb366ad7b7b49a1\\\"}\"]"
}

Doc Type is there:

vagrant@frappe:~/frappe-bench/apps/spms/spms/hardware_management_system/doctype/vendor$ ls -larth
total 36K
-rw-rw-r-- 1 vagrant vagrant  188 Nov 27 16:32 vendor.py
-rw-rw-r-- 1 vagrant vagrant  166 Nov 27 16:32 vendor.js
-rw-rw-r-- 1 vagrant vagrant  169 Nov 27 16:32 test_vendor.py
-rw-rw-r-- 1 vagrant vagrant    0 Nov 27 16:32 __init__.py
drwxrwxr-x 6 vagrant vagrant 4.0K Nov 27 17:33 ..
-rw-rw-r-- 1 vagrant vagrant 1.9K Nov 28 23:12 vendor.json
-rw-rw-r-- 1 vagrant vagrant  358 Nov 28 23:33 vendor_list.js
-rw-rw-r-- 1 vagrant vagrant   77 Dec  2 19:21 api.py
drwxrwxr-x 3 vagrant vagrant 4.0K Dec  2 19:21 .
drwxrwxr-x 2 vagrant vagrant 4.0K Dec  2 19:26 __pycache__
vagrant@frappe:~/frappe-bench/apps/spms/spms/hardware_management_system/doctype/vendor$ 

Please help.

Hi @Narayan_Banik:

Try

 http://ericsson-dbss.com:8000/api/resource/Vendor

(maybe is not capital ā€˜vā€™)

Check the documentation. Awesome reading :wink:
https://frappeframework.com/docs/user/en/api/rest

Hope this helps.

Thanks

Now it gives output:

{
    "data": [
        {
            "name": 1
        },
        {
            "name": 2
        }
    ]
}

It shows only the primary key. How can I add other field to show as well?

Hi @Narayan_Banik:

 http://ericsson-dbss.com:8000/api/resource/Vendor?fields=["field1", "field2"]

Read the docs provided above, a lot of information there.
Hope this helps.

Many thanks