Search…
Read and write data
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.
Request
Body
Response
1
POST https://api.dev.medable.com/{{your_org_name}}/v2/c_prescriptions
Copied!
1
{
2
"c_rx":"Doxycycline 100mg tab. Take one PO bid.",
3
"c_dispense": 60,
4
"c_refills": 3,
5
"c_date":"2016-07-01",
6
"c_patient":"575f58281d0c03a53ccc3ac6",
7
"c_provider":"5771495a1d0c03a53ce83f1a"
8
}
Copied!
1
{
2
"_id": "577c883c6f3035ee08357dfa",
3
"access": 7,
4
"c_date": "2016-07-01",
5
"c_dispense": 60,
6
"c_patient": {
7
"_id": "575f58281d0c03a53ccc3ac6",
8
"object": "account",
9
"path": "/accounts/575f58281d0c03a53ccc3ac6"
10
},
11
"c_provider": {
12
"_id": "5771495a1d0c03a53ce83f1a",
13
"object": "account",
14
"path": "/accounts/5771495a1d0c03a53ce83f1a"
15
},
16
"c_refills": 3,
17
"c_rx": "Doxycycline 100mg tab. Take one PO bid.",
18
"created": "2016-07-06T04:25:32.558Z",
19
"creator": {
20
"_id": "575f58281d0c03a53ccc3ac6",
21
"object": "account",
22
"path": "/accounts/575f58281d0c03a53ccc3ac6"
23
},
24
"favorite": false,
25
"object": "c_prescription",
26
"owner": {
27
"_id": "575f58281d0c03a53ccc3ac6",
28
"object": "account",
29
"path": "/accounts/575f58281d0c03a53ccc3ac6"
30
},
31
"shared": false
32
}
Copied!
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.
Request
Response
1
GET https://api.dev.medable.com/{{your_org_name}}/v2/c_prescriptions
Copied!
1
{
2
"data": [
3
{
4
"_id": "577c883c6f3035ee08357dfa",
5
"access": 7,
6
"c_date": "2016-07-01",
7
"c_dispense": 60,
8
"c_patient": {
9
"_id": "575f58281d0c03a53ccc3ac6",
10
"object": "account",
11
"path": "/accounts/575f58281d0c03a53ccc3ac6"
12
},
13
"c_provider": {
14
"_id": "5771495a1d0c03a53ce83f1a",
15
"object": "account",
16
"path": "/accounts/5771495a1d0c03a53ce83f1a"
17
},
18
"c_refills": 3,
19
"c_rx": "Doxycycline 100mg tab. Take one PO bid.",
20
"created": "2016-07-06T04:25:32.558Z",
21
"creator": {
22
"_id": "575f58281d0c03a53ccc3ac6",
23
"object": "account",
24
"path": "/accounts/575f58281d0c03a53ccc3ac6"
25
},
26
"favorite": false,
27
"object": "c_prescription",
28
"owner": {
29
"_id": "575f58281d0c03a53ccc3ac6",
30
"object": "account",
31
"path": "/accounts/575f58281d0c03a53ccc3ac6"
32
},
33
"shared": false
34
}
35
],
36
"hasMore": false,
37
"object": "list"
38
}
Copied!

Get One

Or to get a specific Prescription we can do the following GET request.
Request
Response
1
GET https://api.dev.medable.com/{{your_org_name}}/v2/c_prescriptions/{{object_id}}
Copied!
1
{
2
"_id": "577c883c6f3035ee08357dfa",
3
"access": 7,
4
"c_date": "2016-07-01",
5
"c_dispense": 60,
6
"c_patient": {
7
"_id": "575f58281d0c03a53ccc3ac6",
8
"object": "account",
9
"path": "/accounts/575f58281d0c03a53ccc3ac6"
10
},
11
"c_provider": {
12
"_id": "5771495a1d0c03a53ce83f1a",
13
"object": "account",
14
"path": "/accounts/5771495a1d0c03a53ce83f1a"
15
},
16
"c_refills": 3,
17
"c_rx": "Doxycycline 100mg tab. Take one PO bid.",
18
"created": "2016-07-06T04:25:32.558Z",
19
"creator": {
20
"_id": "575f58281d0c03a53ccc3ac6",
21
"object": "account",
22
"path": "/accounts/575f58281d0c03a53ccc3ac6"
23
},
24
"favorite": false,
25
"object": "c_prescription",
26
"owner": {
27
"_id": "575f58281d0c03a53ccc3ac6",
28
"object": "account",
29
"path": "/accounts/575f58281d0c03a53ccc3ac6"
30
},
31
"shared": false
32
}
Copied!
For more on CRUD operations on objects, see Cortex API Reference.
Last modified 1mo ago
Copy link