Create User Roles

The Create User Roles API allows you to create a user role within Zenput.

Below is a sample call and a full description of input format, input parameters, and success and error output formats.

POST: /api/v3/userroles/

$ curl -X POST \
  https://www.zenput.com/api/v3/userroles/ \
    -H 'content-type: application/json' \
  -H 'X-API-TOKEN: your-api-token-goes-here' \
  -d '{
    "name": "User role name",
    "parent_role": {
        "id": 1
    },
    "default_permission": {
        "id": 3
    }
}'

Input format:

{
  "name": name,
  "parent": {
    "id": parent_id,
  },
  "default_permission": {
    "id": default_permission_id,
  }
}

Input parameters

Name

Required

Type

Description

name

Required

Text

Name of the user role, must be unique.

parent_id

No

Integer

Id from an existing User Role to set as parent role.

default_permission_id

Required

Integer

Permission ID to set as the default permission for this user role, must be one of: 1: Owner, 2: Manager, 3: Submitter, 4: admin.

🚧

IDs must be from an existing resource

*_id parameters must be from already existing resources.

Output format, success

{
  "meta": {
    "status_code": 201
  },
  "data": {
    "id": 2,
    "name": "User role name",
    "parent": {
      "id": 1,
      "name": "Parent user role"
    },
    "children": [],
    "default_permission": {
      "id": 3,
      "name": "Submitter"
    }
  }
}

Output format, failure

{
  "meta": {
    "status_code": 400
  },
  "errors": [
    {
      "field": "default_permission",
      "message": "This field is required.",
      "code": "required"
    }
  ]
}