Relations


All Relations

You can get a list of all the relations of an entity by using the following endpoint.

{warning} Don't forget that all endpoints documented here need to be prefixed with api/1.0/campaigns/{campaign.id}/.

Method Endpoint Headers
GET/HEAD entities/{entity.id}/relations Default

Results

{
    "data": [
        {
            "owner_id": 168,
            "target_id": 72,
            "relation": "Just Friends",
            "attitude": 22,
            "visibility": "all",
            "is_star": false,
            "colour": null,
            "created_at":  "2019-01-30T00:01:44.000000Z",
            "created_by": 1,
            "updated_at":  "2019-08-29T13:48:54.000000Z"
        }
    ]
}

Relation

To get the details of a single relation, use the following endpoint.

Method Endpoint Headers
GET/HEAD entities/{entity.id}/relations/{relation.id} Default

Results

{
    "data": {
        "owner_id": 168,
        "target_id": 72,
        "relation": "Just Friends",
        "attitude": 22,
        "visibility": "all",
        "is_star": true,
        "colour": "/en-US/docs/1.0/relations#22bbff",
        "created_at":  "2019-01-30T00:01:44.000000Z",
        "created_by": 1,
        "updated_at":  "2019-08-29T13:48:54.000000Z"
    }
}

Create a relation

To create a relation, use the following endpoint.

Method Endpoint Headers
POST entities/{entity.id}/relations Default

Body

Parameter Type Detail
relation string (Required, max 255) Description of the relation
owner_id integer (Required) The relation's entity
target_id integer (Required) The relation's target entity
attitude integer -100 to 100
colour string Hex colour of the attitude (with or without the #)
two_way boolean If set, will duplicate the relation but in the other direction
is_star boolean If the relation is visible on the entity's submenu
visibility string The visibility of the relation. Either all, admin, admin-self, members or self

Results

{success} Code 200 with JSON body of the new relation.

Update a relation

To update a relation, use the following endpoint.

Method Endpoint Headers
PUT/PATCH entities/{entity.id}/relations/{relation.id} Default

Body

The same body parameters are available as for when creating a relation.

Results

{success} Code 200 with JSON body of the updated relation.

Delete a relation

To delete a relation, use the following endpoint.

Method Endpoint Headers
DELETE entities/{entity.id}/relations/{relation.id} Default

Results

{success} Code 200 with JSON.

All Campaign Relations

You can get a list of all the relations of a campaign by using the following endpoint.

{warning} Don't forget that all endpoints documented here need to be prefixed with api/1.0/campaigns/{campaign.id}/.

Method Endpoint Headers
GET/HEAD relations Default