GET /api/roles
Vypsat všechny role

Examples

GET /api/roles
200
{
  "total": 13,
  "subtotal": 13,
  "page": 1,
  "per_page": 20,
  "search": null,
  "sort": {
    "by": "name",
    "order": "ASC"
  },
  "results": [
    {
      "builtin": 0,
      "cloned_from_id": null,
      "name": "Create hosts",
      "id": 9,
      "description": null,
      "origin": ""
    },
    {
      "builtin": 0,
      "cloned_from_id": null,
      "name": "CRUD hosts",
      "id": 12,
      "description": null,
      "origin": ""
    },
    {
      "builtin": 2,
      "cloned_from_id": null,
      "name": "Default role",
      "id": 7,
      "description": null,
      "origin": "foreman"
    },
    {
      "builtin": 0,
      "cloned_from_id": null,
      "name": "Destroy hosts",
      "id": 8,
      "description": null,
      "origin": ""
    },
    {
      "builtin": 0,
      "cloned_from_id": null,
      "name": "Edit hosts",
      "id": 4,
      "description": null,
      "origin": "foreman"
    },
    {
      "builtin": 0,
      "cloned_from_id": null,
      "name": "Edit partition tables",
      "id": 2,
      "description": null,
      "origin": "foreman"
    },
    {
      "builtin": 0,
      "cloned_from_id": null,
      "name": "Manager",
      "id": 1,
      "description": null,
      "origin": "foreman"
    },
    {
      "builtin": 0,
      "cloned_from_id": null,
      "name": "No rights",
      "id": 10,
      "description": null,
      "origin": ""
    },
    {
      "builtin": 0,
      "cloned_from_id": null,
      "name": "Organization admin",
      "id": 13,
      "description": null,
      "origin": "foreman"
    },
    {
      "builtin": 0,
      "cloned_from_id": null,
      "name": "System admin",
      "id": 14,
      "description": null,
      "origin": "foreman"
    },
    {
      "builtin": 0,
      "cloned_from_id": null,
      "name": "View compute resources",
      "id": 11,
      "description": null,
      "origin": ""
    },
    {
      "builtin": 0,
      "cloned_from_id": null,
      "name": "Viewer",
      "id": 5,
      "description": null,
      "origin": "foreman"
    },
    {
      "builtin": 0,
      "cloned_from_id": null,
      "name": "View hosts",
      "id": 3,
      "description": null,
      "origin": "foreman"
    }
  ]
}

Params

Param Name Description
location_id
Optional

Scope by locations

Validations:

  • Must be a Integer

organization_id
Optional

Scope by organizations

Validations:

  • Must be a Integer

search
Optional

výsledky filtru

Validations:

  • Must be a String

order
Optional

Sort field and order, eg. ‘id DESC’

Validations:

  • Must be a String

page
Optional

Číslo stránky, začíná od jedničky

Validations:

  • Must be a number.

per_page
Optional

Number of results per page to return

Validations:

  • Must be a number.

Search fields

Název kolonky Typ Možné hodnoty
builtin true, false
description text
name string
permission string

GET /api/roles/:id
Zobrazit roli

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

Scope by locations

Validations:

  • Must be a Integer

organization_id
Optional

Scope by organizations

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
Vytvořit roli

Examples

POST /api/roles
{
  "role": {
    "name": "staff",
    "organizations": [],
    "locations": []
  }
}
201
{
  "builtin": 0,
  "cloned_from_id": null,
  "name": "staff",
  "id": 18,
  "description": null,
  "origin": null,
  "filters": [],
  "locations": [],
  "organizations": []
}

Params

Param Name Description
location_id
Optional

Scope by locations

Validations:

  • Must be a Integer

organization_id
Optional

Scope by organizations

Validations:

  • Must be a Integer

role
Required

Validations:

  • Must be a Hash

role[name]
Required

Validations:

  • Must be a String

role[description]
Optional , <span class="translation_missing" title="translation missing: cs-CZ.apipie.nil_allowed">Nil Allowed</span>

Popis role

Validations:

  • Must be a String

role[location_ids]
Optional , <span class="translation_missing" title="translation missing: cs-CZ.apipie.nil_allowed">Nil Allowed</span>

REPLACE locations with given ids

Validations:

  • Must be an array of any type

role[organization_ids]
Optional , <span class="translation_missing" title="translation missing: cs-CZ.apipie.nil_allowed">Nil Allowed</span>

REPLACE organizations with given ids.

Validations:

  • Must be an array of any type


PUT /api/roles/:id
Aktualizovat roli

Examples

PUT /api/roles/8-Destroy%20hosts
{
  "role": {
    "name": "staff"
  }
}
200
{
  "builtin": 0,
  "cloned_from_id": null,
  "name": "staff",
  "id": 8,
  "description": null,
  "origin": "",
  "filters": [
    {
      "id": 10997177
    }
  ],
  "locations": [],
  "organizations": []
}

Params

Param Name Description
location_id
Optional

Scope by locations

Validations:

  • Must be a Integer

organization_id
Optional

Scope by organizations

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 , <span class="translation_missing" title="translation missing: cs-CZ.apipie.nil_allowed">Nil Allowed</span>

Popis role

Validations:

  • Must be a String

role[location_ids]
Optional , <span class="translation_missing" title="translation missing: cs-CZ.apipie.nil_allowed">Nil Allowed</span>

REPLACE locations with given ids

Validations:

  • Must be an array of any type

role[organization_ids]
Optional , <span class="translation_missing" title="translation missing: cs-CZ.apipie.nil_allowed">Nil Allowed</span>

REPLACE organizations with given ids.

Validations:

  • Must be an array of any type


DELETE /api/roles/:id
Smazat roli

Examples

DELETE /api/roles/19
{
  "role": {}
}
200
{
  "id": 19,
  "name": "New Role",
  "builtin": 0,
  "description": null,
  "origin": null,
  "cloned_from_id": null
}

Params

Param Name Description
location_id
Optional

Scope by locations

Validations:

  • Must be a Integer

organization_id
Optional

Scope by organizations

Validations:

  • Must be a Integer

id
Required

Validations:

  • Must be a String


POST /api/roles/:id/clone
Klonovat roli

Examples

POST /api/roles/1/clone
{
  "name": "New Manager",
  "role": {
    "name": "New Manager"
  }
}
201
{
  "id": 15,
  "name": "New Manager",
  "builtin": 0,
  "description": null,
  "origin": null,
  "cloned_from_id": 1
}

Params

Param Name Description
location_id
Optional

Scope by locations

Validations:

  • Must be a Integer

organization_id
Optional

Scope by organizations

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 , <span class="translation_missing" title="translation missing: cs-CZ.apipie.nil_allowed">Nil Allowed</span>

Popis role

Validations:

  • Must be a String

role[location_ids]
Optional , <span class="translation_missing" title="translation missing: cs-CZ.apipie.nil_allowed">Nil Allowed</span>

REPLACE locations with given ids

Validations:

  • Must be an array of any type

role[organization_ids]
Optional , <span class="translation_missing" title="translation missing: cs-CZ.apipie.nil_allowed">Nil Allowed</span>

REPLACE organizations with given ids.

Validations:

  • Must be an array of any type