Search…
Connections
Connection enable access to objects. Once connected, each Object has a number of feeds that can be read and posted to, depending on configured access. Each object property has a minimum required CRUD access level. These are listed in the property table for each object.
Those with Share access to an object can invite others to connect. The level of access you can grant to those you invite depends on the type of object and the level of access you have. We call this the Share Chain.
To disconnect from an object, simply call the Delete route. To remove others from a context, the caller must have Share access to the context for which the connection was created and have more access than the user you are removing. These basic rules apply across all objects.
For more details on using connections, see Using Connections
_id String
The connection identifier
access Number
The access level granted by the connection. In the case of an ownership transfer, the access level is the object’s default owner access. An objects share chain or share ACL defines what access levels can be granted and by whom.
roles ObjectId Array
The instance roles granted by the connection. An objects share ACL defines what roles can be granted and by whom.
context Reference
The connection context. When expanded, imparts the connection’s access level to the caller.
contextSource String
A dot syntax property path context in the invitation context. For example, when the account property of the Patient File is set, the resulting Connection “contextSource” is set to “account”. This enables clients to discern the nature of the Connection. In the case of Patient File, “account” means the target is being asked to act as the patient.
created Date
The date the connection was initiated.
creator Reference
The account id of the connection creator. Expansion paths are fixed at name an image; The caller can only retrieve the connection creator’s name and profile image.
expiresAt Date
For pending connections. the time at which the connection request will expire.
object String
The context’s object name.
state Number
The connection state (Pending: 0, Active: 1).
target Document
The connection target recipient. The email property will only be present if the connection was created using an email address. Conversely, the account property will only be present if the connection was created using an account id. The name property will only be present if the connection creator added one.
account Reference
Optional account identifier. A connection can be created using the account identifier is it is known.
token String
The connection token, only visible to the target.
usesRemaining Number
Defaults to null. The number of times the connection can be loaded before it expires.
1
"_id": "5524165d65a7158820f4c022",
2
"access": 4,
3
"context": {
4
"_id": "5519c01aae2fd2b02915c81f",
5
"object": "c_example",
6
"path": "/c_examples/5519c01aae2fd2b02915c81f"
7
},
8
"created": "2015-04-07T17:39:41.000Z",
9
"creator": {
10
"_id": "5516ee2634d8d93428169c0e",
11
"object": "account",
12
"path": "/accounts/5516ee2634d8d93428169c0e"
13
},
14
"expiresAt": "2015-04-14T17:39:41.246Z",
15
"object": "connection",
16
"state": 0,
17
"target": {
18
"email": "[email protected]",
19
"name": {
20
"first": "Frederick",
21
"last": "Banting"
22
}
Copied!
get
https://api.dev.medable.com
/your_org_name/v2/connections
List
State
Meaning
0
Connection has not yet been accepted by invitee
1
Connection has been accepted by invitee
1
$.ajax({
2
url: "https://api.dev.medable.com/example/v2/connections?paths[]=state&paths[]=context",
3
method: "GET",
4
dataType : "json",
5
xhrFields: {
6
withCredentials: true
7
},
8
headers: {
9
"Medable-Client-Key": "GsAqlhnIMzrDeD8V2MBQWq"
10
}
11
}).done(function(data) {
12
// ...
13
});
Copied!
get
https://api.dev.medable.com
/your_org_name/v2/connections/connection_id
Read
1
$.ajax({
2
url: "https://api.dev.medable.com/example/v2/connections/552419f585b784bc204e73aa",
3
method: "GET",
4
dataType : "json",
5
xhrFields: {
6
withCredentials: true
7
},
8
headers: {
9
"Medable-Client-Key": "GsAqlhnIMzrDeD8V2MBQWq"
10
}
11
}).done(function(data) {
12
// ...
13
});
Copied!
get
https://api.dev.medable.com
/your_org_name/v2/connections/token
Read (Token)
1
$.ajax({
2
url: "https://api.dev.medable.com/example/v2/connections/u0xJRTlDQD8moTuUqeQiCAaFzU1WPdtq?expand[]=context",
3
method: "GET",
4
dataType : "json",
5
xhrFields: {
6
withCredentials: true
7
},
8
headers: {
9
"Medable-Client-Key": "GsAqlhnIMzrDeD8V2MBQWq"
10
}
11
}).done(function(data) {
12
// ...
13
});
Copied!
post
https://api.dev.medable.com
/your_org_name/v2/object_name/object_id/connections
Create
1
$.ajax({
2
url: "https://api.dev.medable.com/example/v2/c_examples/5519c01aae2fd2b02915c81f/connections",
3
method: "POST",
4
dataType : "json",
5
xhrFields: {
6
withCredentials: true
7
},
8
headers: {
9
"Medable-Client-Key": "GsAqlhnIMzrDeD8V2MBQWq"
10
},
11
data: {
12
"targets": [
13
{
14
"object": "account",
15
"email": "[email protected]",
16
"access": 4
17
}
18
]
19
}
20
}).done(function(data) {
21
// ...
22
});
Copied!
post
https://api.dev.medable.com
/your_org_name/v2/connections/token
Apply Connection
1
$.ajax({
2
url: "https://api.dev.medable.com/example/v2/connections/GGrc5KoMMpMsEbDxh2iEsn1dcRmxnNY8",
3
method: "POST",
4
dataType : "json",
5
xhrFields: {
6
withCredentials: true
7
},
8
headers: {
9
"Medable-Client-Key": "GsAqlhnIMzrDeD8V2MBQWq"
10
}
11
}).done(function(data) {
12
// ...
13
});
Copied!
patch
https://api.dev.medable.com/
your_org_name/v2/connections/connection_id
Delete
1
$.ajax({
2
url: "https://api.dev.medable.com/example/v2/connections/5524191c85b784bc204e739f",
3
method: "DELETE",
4
dataType : "json",
5
xhrFields: {
6
withCredentials: true
7
},
8
headers: {
9
"Medable-Client-Key": "GsAqlhnIMzrDeD8V2MBQWq"
10
}
11
}).done(function(data) {
12
// ...
13
});
Copied!
patch
https://api.dev.medable.com
/your_org_name/v2/connections/token
Reject Connection
1
$.ajax({
2
url: "https://api.dev.medable.com/example/v2/connections/u0xJRTlDQD8moTuUqeQiCAaFzU1WPdtq",
3
method: "DELETE",
4
dataType : "json",
5
xhrFields: {
6
withCredentials: true
7
},
8
headers: {
9
"Medable-Client-Key": "GsAqlhnIMzrDeD8V2MBQWq"
10
}
11
}).done(function(data) {
12
// ...
13
});
Copied!
Last modified 1mo ago