Users

Here you can interact with your users registered in Belltastic. You will need the ID of the project related, because every project has its own list of users.

List Users paginated

GET {base_uri}/project/{project_id}/users

Get a paginated list of users available on this project. The user ID represents the ID used in your system, and is sorted by ID ascending.

Example response

GET https://belltastic.com/api/v1/project/1/users

{
  "data": [
    {
      "id": "05e9d499-4dd6-3ef7-83b5-a1328bb1cff1",
      "belltastic_id": 15,
      "email": "[email protected]",
      "name": "John Doe",
      "avatar_url": "https:\/\/via.placeholder.com\/80x80.png\/0033aa?text=john+doe",
      "project_id": 1,
      "unread_notifications_count": 40,
      "created_at": "2021-12-03T10:32:52+00:00",
      "updated_at": "2021-12-03T10:32:52+00:00",
      "deleted_at": null
    },
    {
      "id": "19a1ef31-5119-3fdc-b98f-9872357e2801",
      "belltastic_id": 29,
      "email": "[email protected]",
      "name": "Jane Doe",
      "avatar_url": "https:\/\/via.placeholder.com\/80x80.png\/007744?text=jane+doe",
      "project_id": 1,
      "unread_notifications_count": 40,
      "created_at": "2021-12-03T10:32:52+00:00",
      "updated_at": "2021-12-03T10:32:52+00:00",
      "deleted_at": null
    },
    ...
  ],
  "links": {
    "first": null,
    "last": null,
    "prev": null,
    "next": "https:\/\/belltastic.com\/api\/v1\/project\/1\/users?cursor=eyJleHRlcm5hbF9pZCI6IjUzNmU1OWVjLTkyYzItMzU0Ni1iZDA3LWU3NzUzNmZhZjYzYSIsIl9wb2ludHNUb05leHRJdGVtcyI6dHJ1ZX0"
  },
  "meta": {
    "path": "https:\/\/belltastic.com\/api\/v1\/project\/1\/users",
    "per_page": 10
  }
}

Show user

GET {base_uri}/project/{project_id}/user/{id}

Show a single user.

Example response

GET https://belltastic.com/api/v1/project/1/user/19a1ef31-5119-3fdc-b98f-9872357e2801

{
  "id": "19a1ef31-5119-3fdc-b98f-9872357e2801",
  "belltastic_id": 29,
  "email": "[email protected]",
  "name": "Jane Doe",
  "avatar_url": "https:\/\/via.placeholder.com\/80x80.png\/007744?text=jane+doe",
  "project_id": 1,
  "unread_notifications_count": 40,
  "created_at": "2021-12-03T10:32:52+00:00",
  "updated_at": "2021-12-03T10:32:52+00:00",
  "deleted_at": null
}

Create / Update user

PUT {base_uri}/project/{project_id}/user/{id}

Update the user with new data. If a user with the given ID does not exist, it will create one. As of this moment, only name, email and avatar_url can be updated - other properties will be ignored.

Example request & response

Request: PUT https://belltastic.com/api/v1/project/1/user/19a1ef31-5119-3fdc-b98f-9872357e2801 with body

{
  "email":"[email protected]",
  "name":"Jane Updated Doe",
  "avatar_url":"https://avatars.dicebear.com/api/adventurer/jane-doe.svg"
}

Response:

{
  "message": "User updated.",
  "data": {
    "id": "19a1ef31-5119-3fdc-b98f-9872357e2801",
    "belltastic_id": 29,
    "email": "[email protected]",
    "name": "Jane Updated Doe",
    "avatar_url": "https:\/\/avatars.dicebear.com\/api\/adventurer\/jane-doe.svg",
    "project_id": 1,
    "unread_notifications_count": 40,
    "created_at": "2021-12-03T10:32:52+00:00",
    "updated_at": "2021-12-10T14:10:45+00:00",
    "deleted_at": null
  }
}

Archive user

PUT {base_uri}/project/{project_id}/user/{id}/archive

Archive (soft-delete) the user and its notifications.

The next incoming request to show/update a user (via the API or the Notification Component) will re-create it as a fresh user instance with an empty notifications list.

If the user was archived already, it will do nothing - the deleted_at timestamp will not be updated.

Example response

PUT https://belltastic.com/api/v1/project/1/user/19a1ef31-5119-3fdc-b98f-9872357e2801/archive

{
  "message": "User archived.",
  "data": {
    "id": "19a1ef31-5119-3fdc-b98f-9872357e2801",
    "belltastic_id": 29,
    "email": "[email protected]",
    "name": "Jane Updated Doe",
    "avatar_url": "https:\/\/avatars.dicebear.com\/api\/adventurer\/jane-doe.svg",
    "project_id": 1,
    "unread_notifications_count": 40,
    "created_at": "2021-12-03T10:32:52+00:00",
    "updated_at": "2021-12-11T06:08:40+00:00",
    "deleted_at": "2021-12-11T06:08:40+00:00"
  }
}

Destroy user

DELETE {base_uri}/project/{project_id}/user/{id}

Permanently destroy the user. Related notifications will also be destroyed permanently.

The next incoming request to show/update a user (via the API or the Notification Component) will re-create it as a fresh user instance with an empty notifications list.

DANGER

Data cannot be retrieved after the user has been destroyed as it will be permanently deleted from all our servers.

Example response

DELETE https://belltastic.com/api/v1/project/1/user/4009ec04-377a-3dfd-ba51-8e27bf00ffba

{
  "message": "User deleted."
}