Groups Collection

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
Success Response
Error Response

Request:

GET https://staging.channex.io/api/v1/groups

Success 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

{
"errors": {
"code": "unauthorized",
"title": "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
Success Response
Error Response

Request:

GET https://staging.channex.io/api/v1/groups/:id

Success 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

{
"errors": {
"code": "unauthorized",
"title": "Unauthorized"
}
}

Not Found Error

Status Code: 404 Not Found

{
"errors": {
"code": "not_found",
"title": "Resouce 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
Success Response
Error Response

Request:

POST https://staging.channex.io/api/v1/groups

Query body (JSON):

{
"group": {
"title": "South London Group"
}
}

Success Response Example

Status Code: 201 Created

{
"data": {
"type": "group",
"id": "f5338935-7fe0-40eb-9d7e-4dbf7ecc52c7",
"attributes": {
"id": "f5338935-7fe0-40eb-9d7e-4dbf7ecc52c7",
"title": "South London Group"
},
"relationships": {
"properties": {
"data": []
}
}
}
}

Unauthorised Error Response

Status Code: 401 Unauthorized

{
"errors": {
"code": "unauthorized",
"title": "Unauthorized"
}
}

Validation Error Response

Status Code: 422 Unprocessable Entity

{
"errors": {
"code": "validation_error",
"title": "Validation Error",
"details": {
"title": [
"can't be blank"
]
}
}
}

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
Success Response
Error Response

Request:

PUT https://staging.channex.io/api/v1/groups/:id

Query body (JSON):

{
"group": {
"title": "North London Group"
}
}

Success Response Example

Status Code: 200 OK

{
"data": {
"type": "group",
"id": "f5338935-7fe0-40eb-9d7e-4dbf7ecc52c7",
"attributes": {
"id": "f5338935-7fe0-40eb-9d7e-4dbf7ecc52c7",
"title": "North London Group"
},
"relationships": {
"properties": {
"data": []
}
}
}
}

Unauthorised Error Response

Status Code: 401 Unauthorized

{
"errors": {
"code": "unauthorized",
"title": "Unauthorized"
}
}

Not Found Error

Status Code: 404 Not Found

{
"errors": {
"code": "resource_not_found"
"title": "Resource Not Found"
}
}

Validation Error Response

Status Code: 422 Unprocessable Entity

{
"errors": {
"code": "validation_error",
"title": "Validation Error",
"details": {
"title": [
"can't be blank"
]
}
}
}

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
Error Response

Request:

DELETE https://staging.channex.io/api/v1/groups/:id

Success Response Example

Status Code: 200 OK

{
"meta": {
"message": "Success"
}
}

Bad Request Error Response

Status Code: 400 Bad Request

{
"errors": {
"code": "bad_request",
"title": "Bad Request"
}
}

Unauthorised Error Response

Status Code: 401 Unauthorized

{
"errors": {
"code": "unauthorized",
"title": "Unauthorized"
}
}

Not Found Error

Status Code: 404 Not Found

{
"errors": {
"code": "resource_not_found"
"title": "Resource 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
Error Response

Request:

POST https://staging.channex.io/api/v1/groups/:group_id/properties/:property_id

Success Response Example

Status Code: 200 OK

{
"meta": {
"message": "Success"
}
}

Unauthorised Error Response

Status Code: 401 Unauthorized

{
"errors": {
"code": "unauthorized",
"title": "Unauthorized"
}
}

Not Found Error

Status Code: 404 Not Found

{
"errors": {
"code": "resource_not_found",
"title": "Resource Not Found"
}
}

Validation Error Response

Status Code: 422 Unprocessable Entity

{
"errors": {
"code": "validation_error",
"title": "Validation Error",
"details": {
"hotel_id": [
"Only one GroupHotel entity per Group and Hotel pair allowed!"
]
}
}
}

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
Error Response

Request:

DELETE https://staging.channex.io/api/v1/groups/:group_id/properties/:property_id

Success Response Example

Status Code: 200 OK

{
"meta": {
"message": "Success"
}
}

Bad Request Error Response

Status Code: 400 Bad Request

{
"errors": {
"code": "bad_request",
"title": "Bad Request"
}
}

Unauthorised Error Response

Status Code: 401 Unauthorized

{
"errors": {
"code": "unauthorized",
"title": "Unauthorized"
}
}

Not Found Error

Status Code: 404 Not Found

{
"errors": {
"code": "resource_not_found",
"title": "Resource 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.