After we've completed setting up the object classes and their properties , we are ready to start reading and writing data in the format we just specified. More specifically, we'll create instances of the Prescription class in the Medable cloud.
The following examples use HTTP. This is most applicable for web development. You might issue these HTTP requests using a tool like Fetch or Ajax. If you're doing iOS or Android development, we wrote SDK's that make it easier for you to interact with these endpoints.
Create
Creating prescriptions is a simple matter of a POST request to the object route.
POST https://api.dev.medable.com/{{your_org_name}}/v2/c_prescriptions
{"c_rx":"Doxycycline 100mg tab. Take one PO bid.","c_dispense": 60,"c_refills": 3,"c_date":"2016-07-01","c_patient":"575f58281d0c03a53ccc3ac6","c_provider":"5771495a1d0c03a53ce83f1a"}
{"_id": "577c883c6f3035ee08357dfa","access": 7,"c_date": "2016-07-01","c_dispense": 60,"c_patient": {"_id":"575f58281d0c03a53ccc3ac6","object":"account","path":"/accounts/575f58281d0c03a53ccc3ac6" },"c_provider": {"_id":"5771495a1d0c03a53ce83f1a","object":"account","path":"/accounts/5771495a1d0c03a53ce83f1a" },"c_refills": 3,"c_rx": "Doxycycline 100mg tab. Take one PO bid.","created": "2016-07-06T04:25:32.558Z","creator": {"_id":"575f58281d0c03a53ccc3ac6","object":"account","path":"/accounts/575f58281d0c03a53ccc3ac6" },"favorite": false,"object": "c_prescription","owner": {"_id":"575f58281d0c03a53ccc3ac6","object":"account","path":"/accounts/575f58281d0c03a53ccc3ac6" },"shared": false}
Following this process using the WAPI would look like this:
Change the account IDs forc_patient and c_provider to match those in your org.
Get Many
To get that prescription we just created back, we can simply do a GET request.
GET https://api.dev.medable.com/{{your_org_name}}/v2/c_prescriptions
{"data": [ {"_id":"577c883c6f3035ee08357dfa","access":7,"c_date":"2016-07-01","c_dispense":60,"c_patient": {"_id":"575f58281d0c03a53ccc3ac6","object":"account","path":"/accounts/575f58281d0c03a53ccc3ac6" },"c_provider": {"_id":"5771495a1d0c03a53ce83f1a","object":"account","path":"/accounts/5771495a1d0c03a53ce83f1a" },"c_refills":3,"c_rx":"Doxycycline 100mg tab. Take one PO bid.","created":"2016-07-06T04:25:32.558Z","creator": {"_id":"575f58281d0c03a53ccc3ac6","object":"account","path":"/accounts/575f58281d0c03a53ccc3ac6" },"favorite":false,"object":"c_prescription","owner": {"_id":"575f58281d0c03a53ccc3ac6","object":"account","path":"/accounts/575f58281d0c03a53ccc3ac6" },"shared":false } ],"hasMore": false,"object": "list"}
Get One
Or to get a specific Prescription we can do the following GET request.
GET https://api.dev.medable.com/{{your_org_name}}/v2/c_prescriptions/{{object_id}}
{"_id": "577c883c6f3035ee08357dfa","access": 7,"c_date": "2016-07-01","c_dispense": 60,"c_patient": {"_id":"575f58281d0c03a53ccc3ac6","object":"account","path":"/accounts/575f58281d0c03a53ccc3ac6" },"c_provider": {"_id":"5771495a1d0c03a53ce83f1a","object":"account","path":"/accounts/5771495a1d0c03a53ce83f1a" },"c_refills": 3,"c_rx": "Doxycycline 100mg tab. Take one PO bid.","created": "2016-07-06T04:25:32.558Z","creator": {"_id":"575f58281d0c03a53ccc3ac6","object":"account","path":"/accounts/575f58281d0c03a53ccc3ac6" },"favorite": false,"object": "c_prescription","owner": {"_id":"575f58281d0c03a53ccc3ac6","object":"account","path":"/accounts/575f58281d0c03a53ccc3ac6" },"shared": false}