Skip to Content
Roles

Create a role to a given organization

POST
/organizations/{organization_id}/roles

Path Parameters

organization_id*string

The numeric ID or URL Slug of an organization.

Header Parameters

Accept*string

application/json

Authorization*string

Bearer {{access_token}}

Content-Type*string

application/json

Request Body

A JSON object containing the resource data

application/json
  1. body
name*string

The role's name. Must be at least 2 characters. Must not be greater than 60 characters.

description?string

Description of this role. Must not be greater than 255 characters.

permissions*RolePermissions

The list of permissions granted for this role

Response Body

Created

application/json
  1. response
id*integer

The unique ID of the given role

name*string

The name of the given role

description*string

Description of this role

is_predefined*boolean

Defines if the role is predefined or a custom role for specific organization

permissions*RolePermissions

The list of permissions granted for this role

parent*|null
organization?|null
created_by_user?|null
created_at*string

The date and time when the record was created

updated_at*string

The date and time when the record was last updated

Example Request
curl -X POST 'https://api.devopness.com/organizations/johndoe/roles' \  -H 'Accept: application/json' \  -H 'Authorization: Bearer <your_api_token>' \  -H 'Content-Type: application/json' \  -H 'Content-Type: application/json' \  -d '{  "name": "admin",  "permissions": [    "application:read",    "application:create",    "server:read"  ]}'
Example Response
{  "id": 45678,  "name": "admin",  "description": "Has total access to resources",  "is_predefined": false,  "permissions": [    "application:read",    "application:create",    "server:read"  ],  "parent": {    "id": 45678,    "name": "admin",    "description": "Has total access to resources",    "is_predefined": false,    "permissions": [      "application:read",      "application:create",      "server:read"    ],    "organization": {      "id": 16523,      "name": "My Organization",      "url_slug": "MyOrganization",      "resource_summary": [        {          "resource_type": "environment",          "resource_type_plural": "environments",          "resource_type_human_readable": "Environment",          "resource_type_human_readable_plural": "Environments",          "summary": {            "count": 1          }        }      ],      "owner": {        "id": 1,        "name": "string",        "email": "user@example.com",        "url_slug": "someone",        "language": "en",        "active": true,        "created_at": "2019-09-25T15:50:48.000000Z",        "updated_at": "2019-09-25T13:52:04.000000Z"      },      "created_at": "2019-09-25T15:50:48.000000Z",      "updated_at": "2019-09-25T13:52:04.000000Z"    },    "created_by_user": {      "id": 1,      "name": "string",      "email": "user@example.com",      "url_slug": "someone",      "language": "en",      "active": true,      "created_at": "2019-09-25T15:50:48.000000Z",      "updated_at": "2019-09-25T13:52:04.000000Z"    },    "created_at": "2019-09-25T13:22:37.000000Z",    "updated_at": "2019-09-25T13:22:37.000000Z"  },  "organization": {    "id": 16523,    "name": "My Organization",    "url_slug": "MyOrganization",    "resource_summary": [      {        "resource_type": "environment",        "resource_type_plural": "environments",        "resource_type_human_readable": "Environment",        "resource_type_human_readable_plural": "Environments",        "summary": {          "count": 1        }      }    ],    "owner": {      "id": 1,      "name": "string",      "email": "user@example.com",      "url_slug": "someone",      "language": "en",      "active": true,      "created_at": "2019-09-25T15:50:48.000000Z",      "updated_at": "2019-09-25T13:52:04.000000Z"    },    "created_at": "2019-09-25T15:50:48.000000Z",    "updated_at": "2019-09-25T13:52:04.000000Z"  },  "created_by_user": {    "id": 1,    "name": "string",    "email": "user@example.com",    "url_slug": "someone",    "language": "en",    "active": true,    "created_at": "2019-09-25T15:50:48.000000Z",    "updated_at": "2019-09-25T13:52:04.000000Z"  },  "created_at": "2019-09-25T13:22:37.000000Z",  "updated_at": "2019-09-25T13:22:37.000000Z"}