Note that according to http://jsonapi.org/format/#crud-updating-to-many-relationships, to-many relationships are required to have an array as their data object.
Get List of Parent Roles
GET @apiroot/roles/{urlencoded rolename}/relationships/parents
Example Request
EMPTY
Example Response
{
"data": [
{
"type": "group",
"id": "Administrators",
"links": {
"self": "@apiroot/roles/Administrators"
}
},
{
"type": "group",
"id": "Contract Managers",
"links": {
"self": "@apiroot/roles/Contract+Managers"
}
}
]
}
Add Parent Roles
POST @apiroot/roles/{urlencoded rolename}/relationships/parents
Example Request
{
"data": [
{
"type": "group",
"id": "Administrators"
}
]
}
Example Response
200 Success EMPTY
Role does not exist:
404 Not Found EMPTY
Remove Parent Roles
DELETE @apiroot/roles/{urlencoded rolename}/relationships/parents
Example Request
{
"data": [
{
"type": "group",
"id": "Administrators"
}
]
}
Example Response
Success:
200 Success EMPTY
Role does not exist:
404 Not Found EMPTY
Role Children
Note that according to http://jsonapi.org/format/#crud-updating-to-many-relationships, to-many relationships are required to have an array as their data object.
Get List of Child Roles
Example Request
EMPTY
Example Response
{
"data": [
{
"type": "user",
"id": "smurray",
"links": {
"self": "@apiroot/roles/smurray"
}
},
{
"type": "user",
"id": "josh",
"links": {
"self": "@apiroot/roles/josh"
}
}
]
}
Add Child Roles
POST @apiroot/roles/{urlencoded rolename}/relationships/children
Note that standard JSON API requires updates to be a POST. PATCH does a complete replacement.
Example Request
{
"data": [
{
"type": "user",
"id": "jjones"
}
]
}
Example Response
Success:
200 Success EMPTY
Roles does not exist:
404 Not Found EMPTY
Remove Child Roles
DELETE @apiroot/roles/{urlencoded rolename}/relationships/children
Example Request
{
"data": [
{
"type": "user",
"id": "jjones"
}
]
}
Example Response
Success:
200 Success EMPTY
Role does not exist:
404 Not Found EMPTY