API

Roles

Overview

  1. Create a role
  2. Get a role
  3. Update a role
  4. Delete a role

Create a role

Endpoint

POST https://api.siteleaf.com/v2/sites/:site_id/roles

Input

Name Type Desc
user_id String User ID
kind String Can be one of admin, publisher or writer

Example

{
  "user_id": "5697cc7b16d5640c40000000",
  "kind": "admin"
}

Response

Status: 201 Created
{
  "id": "5697cc7b16d5640c40000003",
  "kind": "admin"
  "user_id": "5697cc7b16d5640c40000000",
  "site_id": "5697cc7b16d5640c40000002",
  "created_at": "2023-12-18 17:00:23 +0000",
  "updated_at": "2024-01-14 05:37:58 +0000"
}

Get a role

Endpoint

GET https://api.siteleaf.com/v2/roles/:role_id

Response

Status: 200 OK
{
  "id": "5697cc7b16d5640c40000003",
  "kind": "admin"
  "user_id": "5697cc7b16d5640c40000000",
  "site_id": "5697cc7b16d5640c40000002",
  "created_at": "2023-12-18 17:00:23 +0000",
  "updated_at": "2024-01-14 05:37:58 +0000"
}

Update a role

Endpoint

PUT https://api.siteleaf.com/v2/roles/:role_id

Input

Name Type Desc
kind String Can be one of admin, publisher or writer

Example

{
  "user_id": "5697cc7b16d5640c40000000",
  "kind": "admin"
}

Response

Status: 200 OK
{
  "id": "5697cc7b16d5640c40000003",
  "kind": "admin"
  "user_id": "5697cc7b16d5640c40000000",
  "site_id": "5697cc7b16d5640c40000002",
  "created_at": "2023-12-18 17:00:23 +0000",
  "updated_at": "2024-01-14 05:37:58 +0000"
}

Delete a role

Endpoint

DELETE https://api.siteleaf.com/v2/roles/:role_id

Response

Status: 200 OK
{
  "id": "5697cc7b16d5640c40000003",
  "deleted": true
}

Help improve this page