Create device role
POST
/api/device-roles
const url = 'http://localhost:3000/api/device-roles';const options = { method: 'POST', headers: {cookie: 'session=<session>', 'Content-Type': 'application/json'}, body: '{"name":"example","slug":"example","color":"#4F6EF7","description":"example","tier":"access","redundancy":"optional","complianceBaselines":["example"],"vmRole":false,"typicalLocation":"example","responsibilities":"example","popular":false}'};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}curl --request POST \ --url http://localhost:3000/api/device-roles \ --header 'Content-Type: application/json' \ --cookie session=<session> \ --data '{ "name": "example", "slug": "example", "color": "#4F6EF7", "description": "example", "tier": "access", "redundancy": "optional", "complianceBaselines": [ "example" ], "vmRole": false, "typicalLocation": "example", "responsibilities": "example", "popular": false }'Authorizations
Section titled “Authorizations ”Request Body required
Section titled “Request Body required ” Media type application/json
object
name
required
string
slug
Auto-generated from name when omitted
string
color
string
description
string
tier
string
redundancy
string
complianceBaselines
Array<string>
vmRole
boolean
typicalLocation
string
responsibilities
string
popular
boolean
Responses
Section titled “ Responses ”DeviceRole created
Media type application/json
object
data
object
id
required
string format: uuid
name
required
string
slug
string
color
string
description
string
tier
string
redundancy
string
complianceBaselines
Array<string>
vmRole
boolean
typicalLocation
string
responsibilities
string
popular
boolean
source
string
createdAt
required
string format: date-time
updatedAt
required
string format: date-time
Example
{ "data": { "source": "vendor" }}Validation error
Media type application/json
object
error
required
string
Example
{ "error": "Not found"}Not authenticated
Media type application/json
object
error
required
string
Example
{ "error": "Not found"}