Add an Access Role

POST /api/v2/roles.json

Add an Access Role.

Scope

Requires the roles OAuth scope.

Request body

Your request body must contain an object including:

data required
Containing a Access Role object.


Example

To add an Access Role you must POST JSON to this resource within a data object. The minimum requirement for an Access Role is a title value.

{
    "data": {
        "title": "Partner"
    }
}

In the example above, reference is omitted and will be auto-generated. However, we recommend defining the reference yourself.

{
    "data": {
        "title": "Partner",
        "reference": "partner"
    }
}

Success responses

If the Access Role was created successfully you should receive a response with a 201 status code:

success
A boolean where a value of true means the object was created successfully.
status
The HTTP status code e.g. 201 means the object was created successfully.
data
Contains the Access Role object you created including its new id.


Error responses

If the Access Role could not be created you will encounter a response with a 422 status code:

success
A boolean where a value of false means the object could not be created.
status
A response code of 422 means the object could not be created and you should check the errors property for further information.
context
The context property indicates where the error occurred. For a 422 error this will typically contain a value of data, indicating that there was an error with the data object supplied.
errors

Contains an array of error objects, each will have the following properties:

  • name - The property name that encountered an error.
  • message - A human readable error message.
  • ref - An error reference string (e.g. error.not-unique if the alias supplied is already in use).