GET /api/roles
List all roles

Params

Param name Description
location_id
optional

Set the current location context for the request

Validations:

  • Must be a Integer

organization_id
optional

Set the current organization context for the request

Validations:

  • Must be a Integer

search
optional

filter results

Validations:

  • Must be a String

order
optional

Sort field and order, eg. ‘id DESC’

Validations:

  • Must be a String

page
optional

Page number, starting at 1

Validations:

  • Must be a number.

per_page
optional

Number of results per page to return

Validations:

  • Must be a number.

Search fields

Field name Type Possible values
builtin true, false
description text
name string
permission string

GET /api/roles/:id
Show a role

Examples

GET /api/roles/1-Manager
200
{
  "builtin": 0,
  "cloned_from_id": null,
  "name": "Manager",
  "id": 1,
  "description": null,
  "origin": "foreman",
  "filters": [
    {
      "id": 139728896
    },
    {
      "id": 169533705
    },
    {
      "id": 170801529
    },
    {
      "id": 222559602
    },
    {
      "id": 225912082
    },
    {
      "id": 255448041
    },
    {
      "id": 291325508
    },
    {
      "id": 321349837
    },
    {
      "id": 340438230
    },
    {
      "id": 343831726
    },
    {
      "id": 372277853
    },
    {
      "id": 503111935
    },
    {
      "id": 528928374
    },
    {
      "id": 557298380
    },
    {
      "id": 592288835
    },
    {
      "id": 595149887
    },
    {
      "id": 643462867
    },
    {
      "id": 679608033
    },
    {
      "id": 721145960
    },
    {
      "id": 943645556
    },
    {
      "id": 977587707
    },
    {
      "id": 980424071
    },
    {
      "id": 1025364382
    },
    {
      "id": 1026099682
    },
    {
      "id": 1062414187
    }
  ],
  "locations": [],
  "organizations": []
}

Params

Param name Description
location_id
optional

Set the current location context for the request

Validations:

  • Must be a Integer

organization_id
optional

Set the current organization context for the request

Validations:

  • Must be a Integer

id
required

Validations:

  • Must be an identifier, string from 1 to 128 characters containing only alphanumeric characters, space, underscore(_), hypen(-) with no leading or trailing space.

description
optional

Validations:

  • Must be a String


POST /api/roles
Create a role

Params

Param name Description
location_id
optional

Set the current location context for the request

Validations:

  • Must be a Integer

organization_id
optional

Set the current organization context for the request

Validations:

  • Must be a Integer

role
required

Validations:

  • Must be a Hash

role[name]
required

Validations:

  • Must be a String

role[description]
optional , nil allowed

Role description

Validations:

  • Must be a String

role[location_ids]
optional , nil allowed

REPLACE locations with given ids

Validations:

  • Must be an array of any type

role[organization_ids]
optional , nil allowed

REPLACE organizations with given ids.

Validations:

  • Must be an array of any type


PUT /api/roles/:id
Update a role

Params

Param name Description
location_id
optional

Set the current location context for the request

Validations:

  • Must be a Integer

organization_id
optional

Set the current organization context for the request

Validations:

  • Must be a Integer

id
required

Validations:

  • Must be a String

role
required

Validations:

  • Must be a Hash

role[name]
optional

Validations:

  • Must be a String

role[description]
optional , nil allowed

Role description

Validations:

  • Must be a String

role[location_ids]
optional , nil allowed

REPLACE locations with given ids

Validations:

  • Must be an array of any type

role[organization_ids]
optional , nil allowed

REPLACE organizations with given ids.

Validations:

  • Must be an array of any type


DELETE /api/roles/:id
Delete a role

Params

Param name Description
location_id
optional

Set the current location context for the request

Validations:

  • Must be a Integer

organization_id
optional

Set the current organization context for the request

Validations:

  • Must be a Integer

id
required

Validations:

  • Must be a String


POST /api/roles/:id/clone
Clone a role

Examples

POST /api/roles/16/clone
{
  "name": "New Role",
  "role": {
    "description": "updated description",
    "organization_ids": [
      61304186
    ],
    "name": "New Role"
  }
}
201
{
  "id": 17,
  "name": "New Role",
  "builtin": 0,
  "description": "updated description",
  "origin": null,
  "cloned_from_id": 16
}

Params

Param name Description
location_id
optional

Set the current location context for the request

Validations:

  • Must be a Integer

organization_id
optional

Set the current organization context for the request

Validations:

  • Must be a Integer

id
required

Validations:

  • Must be a String

role
required

Validations:

  • Must be a Hash

role[name]
optional

Validations:

  • Must be a String

role[description]
optional , nil allowed

Role description

Validations:

  • Must be a String

role[location_ids]
optional , nil allowed

REPLACE locations with given ids

Validations:

  • Must be an array of any type

role[organization_ids]
optional , nil allowed

REPLACE organizations with given ids.

Validations:

  • Must be an array of any type