Create document via REST API (Lab test)

Hello,

I’m trying to create a lab test (in the healthcare module) via the rest api using postman. I can edit (PUT) a lab test and I can POST a different custom doctype, but somehow it just won’t work for creating (POST) a lab test. I get no error message, so I’m quite unsure what’s going on. Here’s the JSON I try to post, which is based on an existing lab test, i only changed the name from HLC-LAB-2023-00005 to HLC-LAB-2023-00006. Here’s the entire JSON:

{
“data”: {
“name”: “HLC-LAB-2023-00006”,
“owner”: “Administrator”,
“creation”: “2023-05-21 21:18:46.691585”,
“modified”: “2023-05-22 20:30:40.648441”,
“modified_by”: “Administrator”,
“docstatus”: 0,
“idx”: 0,
“naming_series”: “HLC-LAB-.YYYY.-”,
“template”: “regibox”,
“lab_test_name”: “regibox”,
“lab_test_group”: “Laboratory”,
“department”: “All”,
“company”: "Cabinet ",
“status”: “Draft”,
“result_date”: “2023-05-21”,
“expected_result_date”: “2023-05-21”,
“expected_result_time”: “21:18:46.67001”,
“invoiced”: 0,
“patient”: “Jempy Schmit”,
“patient_name”: “Jempy Schmit”,
“patient_age”: “98 Years(s) 1 Month(s) 2 Day(s)”,
“uid”: “199112063226”,
“patient_sex”: “Male”,
“report_preference”: “Email”,
“email”: “jem...@gmail.com”,
“mobile”: “691190425”,
“legend_print_position”: “Bottom”,
“email_sent”: 0,
“sms_sent”: 0,
“printed”: 0,
“normal_toggle”: 1,
“imaging_toggle”: 0,
“descriptive_toggle”: 0,
“sensitivity_toggle”: 0,
“doctype”: “Lab Test”,
“sensitivity_test_items”: [],
“organism_test_items”: [],
“normal_test_items”: [],
“codification_table”: [],
“descriptive_test_items”: []
}
}

API ENDPOINT: https://[…]/api/resource/Lab Test/

Note: So far, only HLC-LAB-2023-00005 exists in ERPNEXT. I try to create document HLC-LAB-2023-00006, which does not currently exist. As a return, i get the list of the already existing lab tests (HLC-LAB-2023-00001 through HLC-LAB-2023-00005), but not the newly created HLC-LAB-2023-00006. below, the output from postman:

Any ideas as to what might be going on?

The request tool should give some indication about what happened.

If not, check:

  • how to use the tool
  • the network connection: site, domain, ip, port
  • the status code if a connection happened
  • error messages given as answer
    and take it from there.

The api itself is talkative enough to give you some hints, once you get to connect to it.