GET /api/v2/admin/allowed_domains
Get all allowed domains

Headers

Header name Description
Content-Type
required
application/json
X-API-KEY
required
YOUR_API_KEY

Examples

// Successful request
GET /api/v2/admin/allowed_domains
200
{
  "allowed_domains": []
}
// Not admin user
GET /api/v2/admin/allowed_domains
401

Errors

Code Description
401 Unauthorized
404 Not found
500 Internal Server Error
422 Missing parameters

POST /api/v2/admin/allowed_domains
Add allowed domain

Headers

Header name Description
Content-Type
required
application/json
X-API-KEY
required
YOUR_API_KEY

Params

Param name Description
domain
required

Domain

Validations:

  • Must be a String

user_role_id
required

user role ID

Validations:

  • Must be a Integer

Examples

// Not admin user
POST /api/v2/admin/allowed_domains
401
// Successful request
POST /api/v2/admin/allowed_domains
{
  "domain": "example.com",
  "user_role_id": 1
}
200
{
  "allowed_domain": {
    "id": 1,
    "domain": "example.com",
    "created_at": "2023-11-27T09:42:47.735Z",
    "updated_at": "2023-11-27T09:42:47.735Z",
    "user_role_id": 1,
    "user_role": {
      "id": 1,
      "name": "admin",
      "created_at": "2023-11-27T09:42:35.117Z",
      "updated_at": "2023-11-27T09:42:35.289Z",
      "description": "System default"
    }
  }
}
// With invalid parameters
POST /api/v2/admin/allowed_domains
{
  "domain": "examplecom",
  "user_role_id": 1
}
400
{
  "error": "Domain is invalid"
}

Errors

Code Description
401 Unauthorized
404 Not found
500 Internal Server Error
422 Missing parameters

POST /api/v2/admin/allowed_domains/:allowed_domain_id
Update allowed domain

Headers

Header name Description
Content-Type
required
application/json
X-API-KEY
required
YOUR_API_KEY

Params

Param name Description
domain
required

Domain

Validations:

  • Must be a String

user_role_id
required

user role ID

Validations:

  • Must be a Integer

Examples

// Not admin user
POST /api/v2/admin/allowed_domains/:allowed_domain_id
401
// Allowed domain not found
POST /api/v2/admin/allowed_domains/:allowed_domain_id
{
  "domain": "new-example.com",
  "user_role_id": 2
}
404
{
  "error": "Couldn't find AllowedDomain with 'id'=:allowed_domain_id"
}
// Successful request
POST /api/v2/admin/allowed_domains/2
{
  "domain": "new-example.com",
  "user_role_id": 2
}
200
{
  "allowed_domain": {
    "domain": "new-example.com",
    "user_role_id": 2,
    "id": 2,
    "created_at": "2023-11-27T09:42:48.159Z",
    "updated_at": "2023-11-27T09:42:48.253Z",
    "user_role": {
      "id": 2,
      "name": "default",
      "created_at": "2023-11-27T09:42:35.293Z",
      "updated_at": "2023-11-27T09:42:35.425Z",
      "description": "System default"
    }
  }
}

Errors

Code Description
401 Unauthorized
404 Not found
500 Internal Server Error
422 Missing parameters

DELETE /api/v2/admin/allowed_domains/:allowed_domain_id
Remove allowed domain

Headers

Header name Description
Content-Type
required
application/json
X-API-KEY
required
YOUR_API_KEY

Examples

// Not admin user
DELETE /api/v2/admin/allowed_domains/:allowed_domain_id
401
// Allowed domain not found
DELETE /api/v2/admin/allowed_domains/:allowed_domain_id
404
{
  "error": "Couldn't find AllowedDomain with 'id'=:allowed_domain_id"
}
// Successful request
DELETE /api/v2/admin/allowed_domains/3
200
{
  "ok": "allowed domain removed successfully"
}

Errors

Code Description
401 Unauthorized
404 Not found
500 Internal Server Error
422 Missing parameters