Kanka logo Kanka

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,
            "is_private": false,
            "created_at": {
                "date": "2018-04-18 12:49:16.000000",
                "timezone_type": 3,
                "timezone": "UTC"
            },
            "updated_at": {
                "date": "2018-04-18 12:49:16.000000",
                "timezone_type": 3,
                "timezone": "UTC"
            }
        }
    ]
}

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,
        "is_private": false,
        "created_at": {
            "date": "2018-04-18 12:49:16.000000",
            "timezone_type": 3,
            "timezone": "UTC"
        },
        "updated_at": {
            "date": "2018-04-18 12:49:16.000000",
            "timezone_type": 3,
            "timezone": "UTC"
        }
    }
}

Create an relation

To create an 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 (Required) -100 to 100
two_way boolean If set, will duplicate the relation but in the other direction
is_private boolean If the relation is only visible to admin members of the campaign

Results

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

Update an relation

To update an 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 an relation.

Results

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

Delete an relation

To delete an relation, use the following endpoint.

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

Results

{success} Code 200 with JSON.