Search…
Property Selection
Selecting context response properties using the API is accomplished using paths, include and expand query arguments.
paths
string[]
An array of properties to which the response should be limited.
include
string[]
An array of properties marked as optional that should be included in the response.
expand
string[]
An array of expandable reference that should be expanded in the response.
You can specify any of the above query arguments multiple times. For example, if you need to expand multiple properties, you can do so with the following query string.
1
?expand[]=account&expand[]=c_customProperty1&expand[]=c_customProperty2
Copied!

Examples

The example below shows:
    A reference automatically expanded by selecting a path in the referenced context (creator.name.first).
    A response limited to the paths specified by the paths[] query arguments.
    An explicit reference expansion using expand[]=account.
    An optional path included with include[]=connections.
    An implicitly included optional path through the use of paths[]=posts;
Example
Response
1
$.ajax({
2
url: "https://api.dev.medable.com/example/patientfiles/550891732390ac1832f3317f?expand[]=account&include[]=connections&paths[]=posts&paths[]=age&paths[]=name.first",
3
type: "GET",
4
contentType: "application/json; charset=UTF-8",
5
dataType : "json",
6
headers: {
7
"Medable-Client-Key": "GsAqlhnIMzrDeD8V2MBQWq"
8
}
9
});
Copied!
1
{
2
"_id": "550891732390ac1832f3317f",
3
"object": "patientfile",
4
"account": {
5
"_id": "550b82336390d9cc34fdd1f0",
6
"access": 1,
7
"name": {
8
"first": "Phineas",
9
"last": "Gage"
10
},
11
"object": "account",
12
"roles": []
13
},
14
"age": 25,
15
"connections": [
16
{
17
"_id": "550b9a25c59c1ef032ab641c",
18
"object": "connection",
19
"access": 2,
20
"context": {
21
"_id": "550891732390ac1832f3317f",
22
"object": "patientfile",
23
"path": "/patientfiles/550891732390ac1832f3317f"
24
},
25
"created": "2015-03-20T03:55:17.000Z",
26
"creator": {
27
"_id": "4578616d706c652055736572",
28
"object": "Account",
29
"path": "/accounts/4578616d706c652055736572"
30
},
31
"state": 1,
32
"target": {
33
"email": "[email protected]"
34
}
35
}
36
],
37
"creator": {
38
"_id": "4578616d706c652055736572",
39
"name": {
40
"first": "Developer"
41
},
42
"object": "account"
43
},
44
"name": {
45
"first": "Phineas"
46
}
47
"posts": []
48
}
Copied!
Another example would be to automatically expand into the account reference and limit the properties to first name of the referenced account. The account name may not be accessible to the caller, but the Patient File account property reference has an ACL that allows the name to be read by caller with a Connection to the patient file:
Expand Account Reference
1
// GET /patientfiles/550891732390ac1832f3317f?paths[]=account.name.first
2
3
{
4
"_id": "550891732390ac1832f3317f",
5
"account": {
6
"_id": "550b82336390d9cc34fdd1f0",
7
"name": {
8
"first": "Phineas"
9
},
10
"object": "account"
11
},
12
"object": "patientfile"
13
}
Copied!
Limiting Response Properties
Clients can shrink responses by limiting the properties returned by an API request using the paths query argument. Sub paths must be in dot syntax (eg. name.first) and must exist in the object definition.
    Object responses always include the _id and object properties.
    Selecting an optional property using paths automatically includes it.
    Selecting a path in a reference is possible (eg creator.name.first), automatically expanding the referenced context.
Expanding References
References marked as expandable can be expanded into full objects. This can result in less API calls when the client wants to access information in the referenced object.
Depending on the reference property definition, using expand[] may limit the resulting expansion to a set of paths, may grant greater context access than the caller would normally have or allow greater access to a set of properties.
For more information about configuration options, see the section about References.
Optional Properties
Some object properties are marked as optional. Typically, these are non-critical properties that would be expensive to include in every set of responses. For example, the connections and posts properties of objects are optional so wouldn't be included in the result of a call to GET /patientfiles. To retrieve properties marked as optional, use the include[] query argument.
When using paths[], included optional properties will be part of the response.
List Property Selections
Properties that return a list of contexts, such as posts and connections can have selection arguments passed by prefixing them with the property name. For example:
1
// GET /patientfiles/550891732390ac1832f3317f/connections?paths[]=access
2
3
{
4
"_id": "550891732390ac1832f3317f",
5
"object": "patientfile",
6
"connections": {
7
"object": "list",
8
"hasMore": "false",
9
"data: [{
10
"_id": "550b9a25c59c1ef032ab641c",
11
"object": "connection",
12
"access": 2
13
}]
14
}
15
}
Copied!
Last modified 1mo ago
Copy link
Contents
Examples