• Register

role.create

Description

Create a single role object.  Please see Creating Objects for an overview of how the create method works.

Parameters

role

An role object, as described by the object.describe call.  If a field in the role object is ommitted, a default value will be used if possible.  If extra fields are passed, they will be ignored.

Response

An role object, as described by the object.describe call.  This is actual role that was created.

Examples

A Sample JSON-RPC Role Create Request

{
    "method": "role.create",
    "params": [{"name":"example_role_name"}],
    "id": 1
}

The JSON-RPC Response

{
    "result": {
        "id": 378,
        "created": "2009-12-02T23:46:49Z",
        "updated": "2009-12-02T23:46:49Z",
        "name": "example_role_name",
        "description": "",
        "is_assignable": true,
        "is_predefined": false,
        "object_type": "role"
    },
    "error": null,
    "id": 1
}

Permissions Required

The user who owns the role used to authenticate the role.create call must be a member of one of the following roles

  • Administrator
  • Program Manager
  • Community Manager

See authentication.

Errors

In addition to the standard json-rpc errors and authentication errors, role.create may also return these errors:

HTTP Status Code JSON-RPC Code Error Message Description
400 1000 Invalid Object The object could not be created because the object would be invalid.  See Validating Objects for details on the format of this error.
??? 1001 Duplicate Object The object could not be created because an object already exists with the same identifier.
400 1002 Field "x" is required. The object could not be created because a required field was not specified.  A field marked false for optional was not specified.  The error object data will include the name of the missing field.
??? 2001 Create Failed The object could not be created.  This is the error message of last resort for object creation and usually indicates a systems integration failure, invalid internal data, or a transient issue.  These errors are logged by Mashery.
400 4100 Cannot modify predefined roles Cannot create new roles using reserved role names.

Docs Navigation