Endpoints

Users

Operations around User management.

Endpoints

POST /api/users
GET /api/admin/users
POST /api/users/:userId
GET /api/users/:userId
DELETE /api/users/:userId
GET /api/users/:userId/websites
GET /api/users/:userId/teams

POST /api/users

Creates a user.

Parameters

  • username: (string) The user's username.
  • password: (string) The user's password.
  • role: (boolean) Determines user access, admin or user.

Sample response

{
  "id": "1a457e1a-121a-11ee-be56-0242ac120002",
  "username": "umami",
  "role": "admin",
  "createdAt": "2023-04-13T20:22:55.756Z"
}

GET /api/admin/users

Returns all users. Admin access is required.

Parameters

None

Sample response

[
  {
    "id:" "1a457e1a-121a-11ee-be56-0242ac120002",
    "username": "umami",
    "role": "admin",
    "createdAt": "2023-04-13T20:22:55.756Z"
  }
]

GET /api/users/:userId

Gets a user by ID.

Parameters

None

Sample response

{
  "id": "1a457e1a-121a-11ee-be56-0242ac120002",
  "username": "umami",
  "role": "admin"
}

POST /api/users/:userId

Updates a user.

Parameters

  • username: (optional string) The user's username.
  • password: (optional string) The user's password.
  • role: (optional string) Determines user access, admin or user.

Sample response

{
  "id": "1a457e1a-121a-11ee-be56-0242ac120002",
  "username": "umami",
  "role": "admin",
  "createdAt": "2023-04-13T20:22:55.756Z"
}

DELETE /api/users/:userId

Deletes a user.

Parameters

None

Sample response

ok

GET /api/users/:userId/websites

Gets all websites that belong to a user.

Parameters

  • query: (optional string) Search text.
  • page: (optional number, default 1) Determines page.
  • pageSize: (optional string) Determines how many results to return.
  • orderBy: (optional string, default name) Order by column name.

Sample response

[
  {
    "id": "02d89813-7a72-41e1-87f0-8d668f85008b",
    "userId": "1a457e1a-121a-11ee-be56-0242ac120002",
    "domain": "mywebsite.com",
    "name": "My Website",
    "shareId": null,
    "createdAt": "2023-04-10T23:06:44.250Z",
    "deletedAt": null,
    "resetAt": null,
    "updatedAt": null
  }
]

GET /api/users/:userId/teams

Gets all teams that belong to a user.

Parameters

  • query: (optional string) Search text.
  • page: (optional number, default 1) Determines page.
  • pageSize: (optional string) Determines how many results to return.
  • orderBy: (optional string, default name) Order by column name.

Sample response

[
  {
    "id": "02d89813-7a72-41e1-87f0-8d668f85008b",
    "name": "My Team",
    "createdAt": "2023-04-10T23:06:44.250Z",
    "deletedAt": null,
    "updatedAt": null
  }
]