Groups
API methods to work with Groups
Group is an entity to combine your properties together to make management easier. You can combine properties to one or many groups.
Note: A Property must be a member of a group, you cannot remove from a group unless it is a member of another group
Groups List
Retrieve list of Groups associated with user.
Request:
GET https://staging.bookdirect.com/api/v1/groupsSuccess Response Example
Status Code: 200 OK
{
"data": [
{
"type": "group",
"id": "f5338935-7fe0-40eb-9d7e-4dbf7ecc52c7",
"attributes": {
"id": "f5338935-7fe0-40eb-9d7e-4dbf7ecc52c7",
"title": "User Group"
},
"relationships": {
"properties": {
"data": [
{
"id": "716305c4-561a-4561-a187-7f5b8aeb5920",
"type": "property",
"attributes": {
"id": "716305c4-561a-4561-a187-7f5b8aeb5920",
"title": "Property A"
}
},
{
"id": "1b0e7c64-93b7-49f2-8b3c-99568f78b907",
"type": "property",
"attributes": {
"id": "1b0e7c64-93b7-49f2-8b3c-99568f78b907",
"title": "Property B"
}
}
]
}
}
},
{
"type": "group",
"id": "e1804b27-ca56-4bb6-9fac-8ed9662d3af7",
"attributes": {
"id": "e1804b27-ca56-4bb6-9fac-8ed9662d3af7",
"title": "test"
},
"relationships": {
"properties": {
"data": []
}
}
}
]
}Unauthorised Error Response
Status Code: 401 Unauthorized
Returns
Success
Method can return a Success result with 200 OK HTTP Code if operation is successful. Will contain a list of Group objects in the answer.
Unauthorised Error
Method can return a Unauthorised Error result with 401 Unauthorized HTTP Code if wrong Bearer Token provided.
Get Group by ID
Retrieve specific Group associated with User by ID.
Request:
GET https://staging.bookdirect.com/api/v1/groups/:idSuccess Response Example
Status Code: 200 OK
{
"data": {
"type": "group",
"id": "f5338935-7fe0-40eb-9d7e-4dbf7ecc52c7",
"attributes": {
"id": "f5338935-7fe0-40eb-9d7e-4dbf7ecc52c7",
"title": "User Group"
},
"relationships": {
"properties": {
"data": [
{
"id": "716305c4-561a-4561-a187-7f5b8aeb5920",
"type": "property",
"attributes": {
"id": "716305c4-561a-4561-a187-7f5b8aeb5920",
"title": "Property A"
}
},
{
"id": "1b0e7c64-93b7-49f2-8b3c-99568f78b907",
"type": "property",
"attributes": {
"id": "1b0e7c64-93b7-49f2-8b3c-99568f78b907",
"title": "Property B"
}
}
]
}
}
}
}Unauthorised Error Response
Status Code: 401 Unauthorized
Not Found Error
Status Code: 404 Not Found
Returns
Success
Method can return a Success result with 200 OK HTTP Code if operation is successful. Will contain a Group object in the answer.
Unauthorised Error
Method can return a Unauthorised Error result with 401 Unauthorized HTTP Code if wrong Bearer Token provided or User not have access to requested Property.
Not Found Error
Method can return a Not Found Error result with 404 Not Found HTTP Code if Group with provided ID is not present at system.
Create Group
Create new Group.
Request:
Query body (JSON):
Success Response Example
Status Code: 201 Created
Unauthorised Error Response
Status Code: 401 Unauthorized
Validation Error Response
Status Code: 422 Unprocessable Entity
Fields
title [required]
Any non-empty string with maximum length of 255 symbols. Note: The Group will be represented in the system under that title.
Returns
Success
Method can return a Success result with 201 Created HTTP Code if operation is successful. Will contain a Group object in the answer.
Unauthorised Error
Method can return a Unauthorised Error result with 401 Unauthorized HTTP Code if wrong Bearer Token provided.
Validation Error
Method can return a Validation Error result with 422 Unprocessable Entity HTTP Code if any validation rule is failed.
Update Group
Update Group.
Request:
Query body (JSON):
Success Response Example
Status Code: 200 OK
Unauthorised Error Response
Status Code: 401 Unauthorized
Not Found Error
Status Code: 404 Not Found
Validation Error Response
Status Code: 422 Unprocessable Entity
Fields
title [required]
Any non-empty string with maximum length of 255 symbols. Note: The Group will be represented in the system under that title.
Returns
Success
Method can return a Success result with 200 OK HTTP Code if operation is successful. Will contain a Group object in the answer.
Unauthorised Error
Method can return a Unauthorised Error result with 401 Unauthorized HTTP Code if wrong Bearer Token provided.
Not Found Error
Method can return a Not Found Error result with 404 Not Found HTTP Code if Group with provided ID is not present at system.
Validation Error
Method can return a Validation Error result with 422 Unprocessable Entity HTTP Code if any validation rule is failed.
Remove Group
Remove Group.
Request:
Success Response Example
Status Code: 200 OK
Bad Request Error Response
Status Code: 400 Bad Request
Unauthorised Error Response
Status Code: 401 Unauthorized
Not Found Error
Status Code: 404 Not Found
Returns
Success
Method can return a Success result with 200 OK HTTP Code if operation is successful. Will contain a Meta object with message in the answer.
Bad Request Error
Method can return a Bad Request Error result with 400 Bad Request HTTP Code if the Group you would like to remove has at least one Property attached.
Unauthorised Error
Method can return a Unauthorised Error result with 401 Unauthorized HTTP Code if wrong Bearer Token provided.
Not Found Error
Method can return a Not Found Error result with 404 Not Found HTTP Code if Group with provided ID is not present at system.
Associate Property With Group
Associate Property with Group.
Request:
Success Response Example
Status Code: 200 OK
Unauthorised Error Response
Status Code: 401 Unauthorized
Not Found Error
Status Code: 404 Not Found
Validation Error Response
Status Code: 422 Unprocessable Entity
Returns
Success
Method can return a Success result with 200 OK HTTP Code if operation is successful. Will contain a Meta object with message in the answer.
Unauthorised Error
Method can return a Unauthorised Error result with 401 Unauthorized HTTP Code if wrong Bearer Token provided.
Not Found Error
Method can return a Not Found Error result with 404 Not Found HTTP Code if Group or Property with provided ID is not present at system.
Validation Error
Method can return a Validation Error result with 422 Unprocessable Entity HTTP Code if Property is already associated with a Group.
Remove Property From Group
Remove Property from Group.
Request:
Success Response Example
Status Code: 200 OK
Bad Request Error Response
Status Code: 400 Bad Request
Unauthorised Error Response
Status Code: 401 Unauthorized
Not Found Error
Status Code: 404 Not Found
Returns
Success
Method can return a Success result with 200 OK HTTP Code if operation is successful. Will contain a Meta object with message in the answer.
Bad Request Error
Method can return a Bad Request Error result with 400 Bad Request HTTP Code if the Property you would like to remove from Group not attached to any other Group.
Unauthorised Error
Method can return a Unauthorised Error result with 401 Unauthorized HTTP Code if wrong Bearer Token provided.
Not Found Error
Method can return a Not Found Error result with 404 Not Found HTTP Code if Group or Property with provided ID is not present at system.
Last updated
Was this helpful?