Skip to content

Thing routes: share, unrelate

The Thing Verbs share, unrelate as api.sb routes, with inputs, result, refusals and an example.

Reference for Thing, one group of Thing routes.

Thing.share

Share grants a person, a Role or a guest Verbs on one record and everything it contains. Verb page.

Text
POST /{namespace}/things/{thing}/share

Path: thing. Body, as JSON: the other inputs. Emits Thing.shared.

Inputs

InputTypeRequiredDescription
thingThingrequiredThe record to share.
toPartyrequiredWho receives the grant: a person, or a guest who fills only the guest Role.
verbsstring[]requiredThe Verbs granted, such as get and comment.

Returns

OutputTypeRequiredDescription
permissionPermissionrequiredThe grant, scoped to the record and its contents.
thingThingrequiredThe Thing shared.

Refuses when

CheckErrorFixThen call
The key is valid, but its scopes do not allow this operation.forbiddenUse a key whose scopes cover the operation, or ask an owner of the namespace to grant them.None.

Example

Terminal
curl -X POST https://api.sb/leaseline.app/things/thing_8ds0r9vvRl/share \
  -H "Authorization: Bearer $STARTUP_BUILDER_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"to":"party_hmQWaPrAyZ","verbs":["Example verbs"]}'
JSON
{
  "api": "https://api.sb/leaseline.app",
  "permission": {
    "$id": "https://api.sb/leaseline.app/permissions/permission_1IFL54Tlfx",
    "$type": "Permission",
    "scope": "Example scope"
  },
  "thing": {
    "$id": "https://api.sb/leaseline.app/things/thing_8ds0r9vvRl",
    "$type": "Thing",
    "id": "Example id",
    "type": [
      "noun_v0akLUrXCN"
    ]
  },
  "action": {
    "$id": "https://api.sb/leaseline.app/actions/act_br07HsG8MG",
    "operation": "Thing.share",
    "status": "done"
  },
  "links": {
    "self": "https://api.sb/leaseline.app/actions/act_br07HsG8MG"
  }
}

Thing.unrelate

Unrelate ends a Relationship between two Things; the link stays in history and reads back at any earlier moment. Verb page.

Text
POST /{namespace}/things/{thing}/unrelate

Path: thing. Body, as JSON: the other inputs. Emits Thing.unrelated.

Inputs

InputTypeRequiredDescription
thingThingrequiredThe source Thing.
predicatestringrequiredThe Relationship as read from the source.
toThingrequiredThe target Thing.

Returns

OutputTypeRequiredDescription
relationshipRelationshiprequiredThe ended Relationship.
thingThingrequiredThe Thing the Relationship started from.

Refuses when

CheckErrorFixThen call
The key is valid, but its scopes do not allow this operation.forbiddenUse a key whose scopes cover the operation, or ask an owner of the namespace to grant them.None.

Example

Terminal
curl -X POST https://api.sb/leaseline.app/things/thing_8ds0r9vvRl/unrelate \
  -H "Authorization: Bearer $STARTUP_BUILDER_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"predicate":"Example predicate","to":"thing_8ds0r9vvRl"}'
JSON
{
  "api": "https://api.sb/leaseline.app",
  "relationship": {
    "$id": "https://api.sb/leaseline.app/relationships/relationship_iUVcHztTJh",
    "$type": "Relationship",
    "predicate": "Example predicate",
    "inverse": "Example inverse"
  },
  "thing": {
    "$id": "https://api.sb/leaseline.app/things/thing_8ds0r9vvRl",
    "$type": "Thing",
    "id": "Example id",
    "type": [
      "noun_v0akLUrXCN"
    ]
  },
  "action": {
    "$id": "https://api.sb/leaseline.app/actions/act_br07HsG8MG",
    "operation": "Thing.unrelate",
    "status": "done"
  },
  "links": {
    "self": "https://api.sb/leaseline.app/actions/act_br07HsG8MG"
  }
}