Rest Api for single type doctype document

Hi friends,

  1. How to retrieve a single type doctype document using rest API?
  2. In which table Frappe store data of single type doctypes?
2 Likes

api/resource/Doctype/Doctype
for example:

 api/resource/Dropbox Settings/Dropbox Settings 

It is called Singles,

You can retrieve data from it as following:
Using Query:

Select * from `tabSingles` where doctype = 'Dropbox Settings'

Using frappe ORM:
Either

frappe.get_single(doctype)
frappe.get_single('Dropbox Settings')

OR

frappe.get_doc(doctype,doctype)
frappe.get_doc('Dropbox Settings','Dropbox Settings')
6 Likes

There’s also this …

curl -L -X GET 'https://dev.erpnext.host/api/method/frappe.client.get_single_value' \
-H 'Authorization: token 72d0badbad9e010:0261badbad0ce2190' \
-H 'Content-Type: application/json' \
--data-raw '{
    "doctype": "Website Settings",
    "field": "chat_welcome_message"
}'

… which’ll get you this …

{
    "message": "Hi, how may I help you?"
}