Auto-Accept

Automatically Applying Connections

In some scenarios, it may be necessary to create connections without the target needing to accept the connection. This is possible if the following apply:

  • The context object is not an Account
  • The context object does not require connection acceptance
  • The target is already a registered user and the account _id is used in the target instead of email
  • "auto":true is sent in the connection target

To configure your object to not require connection acceptance, when creating your object or editing your object settings, be sure that Require Connection Accept is unchecked.

1194

Optionally you can uncheck Send Connection Notifications to prevent notifications from going out when connections are created as well.

Automatically applying a connection is then very much like creating a connection like above but with "auto":true added to the target.

POST https://api.dev.medable.com/example/v2/c_prescriptions/576967021d0c03a53cd79fd7/connections
{
   "targets":[
      {
         "object":"account",
         "_id": "552417e085b784bc204e737c",
         "access":4,
         "auto":true
      }
   ]
}
{
    "data": [
        {
            "_id": "576967441d0c03a53cd7a028",
            "access": 4,
            "context": {
                "_id": "576967021d0c03a53cd79fd7",
                "object": "c_prescription",
                "path": "/c_prescriptions/576967021d0c03a53cd79fd7"
            },
            "contextSource": null,
            "created": "2016-06-21T16:11:48.800Z",
            "creator": {
                "_id": "575f58281d0c03a53ccc3ac6",
                "object": "account",
                "path": "/accounts/575f58281d0c03a53ccc3ac6"
            },
            "expiresAt": "2016-06-28T16:11:48.802Z",
            "object": "connection",
            "state": 1,
            "target": {
                "account": {
                    "_id": "552417e085b784bc204e737c",
                    "object": "account",
                    "path": "/accounts/552417e085b784bc204e737c"
                }
            }
        }
    ],
    "hasMore": false,
    "object": "list"
}
📘

Note

The connection is immediately created in state "1" or "Active" without any acceptance needed.

For more details on the connection object, it's properties, and available API routes, see Apply Connection


What’s Next