This example uses curl. You can use any other means of making http requests. Responses are in JSON format.
- Login to frappe (and store cookies in a jar)
% curl https://demo.frappecloud.com/api/method/login -XPOST \-d "usr=demo%40frappecloud.com&pwd=demo" -c frappe.cookie
{"message":"Logged In","full_name":"Demo User"}
- Request for a Sales Invoice by id (output is piped to json pretty printer(optional))
curl https://demo.frappecloud.com/api/resource/Sales%20Invoice/SINV-00041 -b frappe.cookie | json
{
"data": {
"rounded_total_export": 0,
"other_charges": [],
"modified_by": "demo@frappecloud.com",
"selling_price_list": "Standard Selling",
"source": "",
"address_display": "R Patrão Caramelho 116\nFajozes\nPortugal\nPhone: 23566775757",
"due_date": "2014-05-21",
"advance_adjustment_details": [],
"entries": [
{
"item_group": "Products",
"base_price_list_rate": 0,
"creation": "2014-05-21 10:39:48.142927",
"base_amount": 0,
"qty": 20,
"item_tax_rate": "{}",
"rate": 0,
"owner": "demo@frappecloud.com",
"cost_center": "Main - WP",
"so_detail": "SOD/00077",
"actual_qty": 0,
"modified_by": "demo@frappecloud.com",
"discount_percentage": 0,
"item_name": "stove",
"sales_order": "SO-00052",
"amount": 0,
"stock_uom": "Nos",
"warehouse": "Stores - WP",
"docstatus": 1,
"doctype": "Sales Invoice Item",
"description": "1007",
"parent": "SINV-00041",
"brand": "",
"base_rate": 0,
"item_code": "1007",
"delivered_qty": 0,
"price_list_rate": 0,
"name": "INVD000058",
"idx": 1,
"income_account": "Sales - WP",
"modified": "2014-05-22 11:49:08.052007",
"parenttype": "Sales Invoice",
"parentfield": "entries"
}
],
"name": "SINV-00041",
"is_pos": 0,
"net_total_export": 0,
"write_off_amount": 0,
"creation": "2014-05-21 10:39:48.142927",
"modified": "2014-05-22 11:49:08.173456",
"owner": "demo@frappecloud.com",
"territory": "Rest Of The World",
"price_list_currency": "USD",
"contact_display": "Chidumaga Tobeolisa",
"other_charges_total_export": 0,
"aging_date": "2014-05-21",
"customer_address": "Asian Fusion-Office",
"total_commission": 0,
"contact_mobile": "",
"c_form_applicable": "No",
"rounded_total": 0,
"customer_group": "Commercial",
"contact_person": "Chidumaga Tobeolisa-Asian Fusion",
"in_words": "USD Zero only.",
"fiscal_year": "2014",
"conversion_rate": 1,
"against_income_account": "Sales - WP",
"total_advance": 0,
"posting_time": "10:39:38.936089",
"packing_details": [],
"customer_name": "Asian Fusion",
"commission_rate": 0,
"company": "Wind Power LLC",
"contact_email": "ChidumagaTobeolisa@example.com",
"customer": "Asian Fusion",
"grand_total": 0,
"doctype": "Sales Invoice",
"is_opening": "No",
"posting_date": "2014-05-21",
"debit_to": "Asian Fusion - WP",
"naming_series": "SINV-",
"other_charges_total": 0,
"currency": "USD",
"paid_amount": 0,
"recurring_type": "",
"docstatus": 1,
"grand_total_export": 0,
"outstanding_amount": 0,
"in_words_export": "USD Zero only.",
"remarks": "No Remarks",
"plc_conversion_rate": 1,
"net_total": 0,
"sales_team": []
}
}
- To list recent (ie sorted by modified) Sales Invoices,
curl https://demo.frappecloud.com/api/resource/Sales%20Invoice/ -b frappe.cookie | json
{
"data": [
{
"name": "SINV-00041"
},
{
"name": "SINV-00042"
},
....
]
}
For more info, visit https://frappe.io/apps/frappe-framework/developers/api/rest_api
thanks really helpful :)