Campaigns


You can get a list of all the campaigns the user has access to using the following endpoint.

{warning} Don't forget that all endpoints documented here need to be prefixed with 1.0/. For example, campaigns becomes api.kanka.io/1.0/campaigns.

Method URI Headers
GET campaigns Default

Results

{
    "data": [
        {
            "id": 1,
            "name": "Thaelia",
            "locale": "en",
            "entry": "\r\n<p>Aenean sit amet vehicula.</p>\r\n",
            "entry_parsed": "not available on the campaigns/ endpoint",
            "image": "{path}",
            "image_full": "{url}",
            "image_thumb": "{url}",
            "visibility": "public",
            "visibility_id": 2,
            "created_at": "2017-11-02T16:29:34.000000Z",
            "updated_at": "2020-05-23T22:00:02.000000Z",
            "members": [
                {
                    "id": 1,
                    "user": {
                        "id": 1,
                        "name": "Ilestis",
                        "avatar": "{url}"
                    }
                }
            ],
            "setting": [],
            "ui_settings": [],
            "default_images": [],
            "css": "..."
        }
    ],
    "links": {
        "first": "https://api.kanka.io/1.0/campaigns?page=1",
        "last": "https://api.kanka.io/1.0/campaigns?page=1",
        "prev": null,
        "next": null
    },
    "meta": {
        "current_page": 1,
        "from": 1,
        "last_page": 1,
        "path": "http://api.kanka.io/1.0/campaigns",
        "per_page": 15,
        "to": 3,
        "total": 3
    }
}

Single Campaign

Getting a single campaign is straightforward. {id} is to be replaced with the campaign's id returned in the campaigns call.

Method URI Headers
GET campaigns/{id} Default

Results

{
    "data": {
        "id": 1,
        "name": "Thaelia",
        "locale": "fr",
        "entry": "\r\n<p>Aenean sit amet vehicula [character:133].</p>\r\n",
        "entry_parsed": "\r\n<p>Aenean sit amet vehicula <a href=\"...\">Lorem Ipsum</a>.</p>\r\n",
        "image": "{path}",
        "image_full": "{url}",
        "image_thumb": "{url}",
        "visibility": "public",
        "visibility_id": 2,
        "created_at": "2017-11-02T16:29:34.000000Z",
        "updated_at": "2020-05-23T22:00:02.000000Z",
        "members": [
            {
                "id": 1,
                "user": {
                    "id": 1,
                    "name": "Ilestis",
                    "avatar": "{url}"
                }
            }
        ],
        "setting": [],
        "ui_settings": [],
        "default_images": [],
        "css": "..."
    }
}

Campaign Members

To get a list of all the members of a campaign, use the following endpoint.

Method URI Headers
GET campaigns/{id}/users Default

Results

{
    "data": [
        {
            "id": 1,
            "name": "Ilestis",
            "avatar": "{url}"
        },
        {
            "id": 2,
            "name": "Ilestis Jr.",
            "avatar": "{url}"
        }
    ]
}

Campaign Member

To get the info of an specific member of a campaign, use the following endpoint.

Method URI Headers
GET campaigns/{id}/users/{user_id} Default

Results

{
    "data": [
        {
            "id": 1,
            "name": "Ilestis",
            "avatar": "{url}"
        }
    ]
}

Add Role To Member

To add a role to a member of the campaign, use the following endpoint.

Method URI Headers
POST campaigns/{id}/users Default

Body

Parameter Type Detail
user_id integer (Required) The user's id
role_id integer (Required) The role's id

Results

{
    "data": "role successfully added to user"
}

Remove Role From Member

To remove a role from a member of the campaign, use the following endpoint.

Method URI Headers
DELETE campaigns/{id}/users Default

Body

Parameter Type Detail
user_id integer (Required) The user's id
role_id integer (Required) The role's id

Results

{
    "data": "role successfully removed from user"
}

Campaign roles

To get a list of all the roles of a campaign, use the following endpoint.

Method URI Headers
GET campaigns/{id}/roles Default

Results

{
    "data": [
        {
            "id": 114,
            "name": "Admin",
            "is_admin": true
        },
        {
            "id": 115,
            "name": "Public",
            "is_admin": false
        },
        {
            "id": 116,
            "name": "Player",
            "is_admin": false
        }
    ]
}