Groups

The groups API allow you to search, create, fetch, update and delete groups from within the ITC network.


The Group Resource

The group resource contains all information about a requested group

Properties

  • Name
    id
    Required
    Type
    integer
    Description

    Unique identifier for the group.

  • Name
    name
    Required
    Type
    string
    Description

    The name of the group

  • Name
    slug
    Required
    Type
    string
    Description

    The slug of the group

  • Name
    type
    Required
    Type
    string
    Description

    The groups industry

  • Name
    dates.created_at
    Required
    Type
    datetime
    Description

    The date the group was created, represented in YYYY-MM-DD HH:MM:SS format

  • Name
    dates.updated_at
    Required
    Type
    datetime
    Description

    The date the group was last updated, represented in YYYY-MM-DD HH:MM:SS format

  • Name
    dates.deleted_at
    Required
    Type
    null | datetime
    Description

    The date the group was deleted, represented in YYYY-MM-DD HH:MM:SS format. If the group is not deleted, this will be null

Group Resource

{
  "id": 1,
  "name": "Dev Group",
  "slug": "dev-group",
  "type": "motor",
  "dates": {
    "created_at": "2024-01-01 00:00:00",
    "updated_at": "2024-01-02 12:00:00",
    "deleted_at": null,
  }
}

GET/v2/groups

Search Groups

The search groups endpoint uses the standard [/searching](search package) from the SDK.

An array of group resources are returned. If no results are found, an empty collection is returned.

Search Filters

  • Name
    filters.id.equals
    Required
    Type
    integer
    Description

    Match a single group by ID

  • Name
    filters.id.in
    Required
    Type
    array<integer>
    Description

    Match groups by multiple IDs

  • Name
    filters.name.equals
    Required
    Type
    string
    Description

    Match a group by their name

  • Name
    filters.name.in
    Required
    Type
    array<string>
    Description

    Match group by multiple name

  • Name
    filters.name.contains
    Required
    Type
    string
    Description

    Match a group by a partial name

  • Name
    filters.slug.equals
    Required
    Type
    string
    Description

    Match a group by their slug

  • Name
    filters.slug.in
    Required
    Type
    array<string>
    Description

    Match group by multiple slug

  • Name
    filters.type.equals
    Required
    Type
    string
    Description

    Match groups by their type

  • Name
    filters.type.in
    Required
    Type
    array<string>
    Description

    Match groups by multiple types

  • Name
    filters.created_at.before_or_on
    Required
    Type
    datetime
    Description

    Match all groups that were created before or on this datetime.

  • Name
    filters.created_at.after_or_on
    Required
    Type
    datetime
    Description

    Match all groups that were created after or on this datetime.

  • Name
    filters.updated_at.before_or_on
    Required
    Type
    datetime
    Description

    Match all groups that were last updated before or on this datetime.

  • Name
    filters.updated_at.after_or_on
    Required
    Type
    datetime
    Description

    Match all groups that were last updated after or on this datetime.

  • Name
    filters.deleted_at.equals
    Required
    Type
    boolean
    Description

    If you want to only deleted groups from results, provide true. If you only non-deleted groups, provide false

Search Ordering

  • id
  • name
  • slug
  • type
  • created_at
  • updated_at
  • deleted_at

Request

GET
/v2/groups
use Compliance\Sdk\ApexV3\Contracts\ApexV3SdkInterface;
use Compliance\Sdk\Authentication\Types\Machine;
use Compliance\Sdk\Search\Search;

private ApexV3SdkInterface $sdk;

$search = new Search();

$response = $this->sdk
  ->v2(new Machine())
  ->groups()
  ->search($search);

Response

{
  "data": [
    {
      "id": 1,
      "name": "Dev Group",
      "slug": "dev-group",
      "type": "motor",
      "dates": {
        "created_at": "2024-01-01 00:00:00",
        "updated_at": "2024-01-02 00:00:00",
        "deleted_at": null,
      }
    }
  ]
}

GET/v2/groups/:group_id

Retrieve Group

Will retrieve a single group by their ID.

URL Parameters

  • Name
    group_id
    Required
    required
    Type
    integer
    Description

    ID of the group to retrieve

Error Codes

Status Description
404 The requested group could not be found.

Request

GET
/v2/groups/:group_id
use Compliance\Sdk\ApexV3\Contracts\ApexV3SdkInterface;
use Compliance\Sdk\Authentication\Types\Machine;

private ApexV3SdkInterface $sdk;

$response = $this->sdk
  ->v2(new Machine())
  ->group(1)
  ->get();

Response

{
  "data": {
    "id": 1,
    "name": "Dev Group",
    "slug": "dev-group",
    "type": "motor",
    "dates": {
      "created_at": "2024-01-01 00:00:00",
      "updated_at": "2024-01-02 00:00:00",
      "deleted_at": null,
    }
  }
}

POST/v2/groups

Create Group

Will attempt to create a new group.

Payload

  • Name
    name
    Required
    required
    Type
    string
    Description

    The name of the group

  • Name
    type
    Required
    Type
    string
    Description

    The group type. Must be one of the group type enums below.

Error Codes

Status Description
404 The requested group could not be found.
422 The data provided in the payload was invalid. See errors for more details.
409 The group name could not be converted to a slug because another group is using the same slug.

Request

POST
/v2/groups
use Compliance\Sdk\ApexV3\Contracts\ApexV3SdkInterface;
use Compliance\Sdk\Authentication\Types\Machine;

private ApexV3SdkInterface $sdk;

$response = $this->sdk
  ->v2(new Machine())
  ->groups()
  ->create('Test Group', 'motor');

Response

{
  "data": {
    "id": 1,
    "name": "Test Group",
    "slug": "test-group",
    "type": "motor",
    "dates": {
      "created_at": "2024-01-01 00:00:00",
      "updated_at": "2024-01-02 00:00:00",
      "deleted_at": null,
    }
  }
}

PUT/v2/groups/:group_id

Update Group

Will attempt to update the core details of a group.

Only values provided in the request payload will be updated.

URL Parameters

  • Name
    group_id
    Required
    required
    Type
    integer
    Description

    ID of the group to update

Payload

  • Name
    name
    Required
    Type
    string
    Description

    The updated name for the group

  • Name
    type
    Required
    Type
    string
    Description

    Update the groups type. Must be one of the group type enums below.

  • Name
    restore
    Required
    Type
    bool
    Description

    If this group is deleted, provide true to restore it. Any other value is ignored.

Error Codes

Status Description
404 The requested group could not be found.
422 The data provided in the payload was invalid. See errors for more details.

Request

PUT
/v2/groups/:group_id
use Compliance\Sdk\ApexV3\Contracts\ApexV3SdkInterface;
use Compliance\Sdk\Authentication\Types\Machine;

private ApexV3SdkInterface $sdk;

$response = $this->sdk
  ->v2(new Machine())
  ->group(1)
  ->update([
    'name' => 'New Group Name',
    'type' => 'motor',
  ]);

Response

{
  "data": {
    "id": 1,
    "name": "New Group Name",
    "slug": "new-group-name",
    "type": "motor",
    "dates": {
      "created_at": "2024-01-01 00:00:00",
      "updated_at": "2024-01-02 00:00:00",
      "deleted_at": null,
    }
  }
}

DELETE/v2/groups/:group_id

Delete Group

Will attempt to delete the group. This endpoint will only affect non-deleted groups.

The API will return a successful response if the group is already deleted, but won't update the deleted_at timestamp.

URL Parameters

  • Name
    group_id
    Required
    required
    Type
    integer
    Description

    ID of the group to delete

Error Codes

Status Description
404 The requested group could not be found.
409 All dealers within the group must be deleted. If all dealers are not deleted, trying to delete a group will return a 409 status.

Request

DELETE
/v2/group/:group_id
use Compliance\Sdk\ApexV3\Contracts\ApexV3SdkInterface;
use Compliance\Sdk\Authentication\Types\Machine;

private ApexV3SdkInterface $sdk;

$response = $this->sdk
  ->v2(new Machine())
  ->group(1)
  ->delete();

Response

{
  "data": {
    "id": 1,
    "name": "New Group Name",
    "slug": "new-group-name",
    "type": "motor",
    "dates": {
      "created_at": "2024-01-01 00:00:00",
      "updated_at": "2024-01-02 00:00:00",
      "deleted_at": "2024-01-03 00:00:00",
    }
  }
}

Group Type Enum

Value Description
age-concern Age Concern
call-centre Call Centre
claim Claims Management
consumer-credit Consumer Credit
directly-authorised Directly Authorised
finance Finance
gi-mediation General Insurance Mediation
insure-2-travel Insure2Travel
introducer Motor Introducer
landlord-hub Landlord Hub
motor Motor Industry
other Other / ITC Compliance
property Property Management
property-agent Property Agent
payment-shield Payment Shield
satellite Satellite
sony Sony
sony-eu Sony EU
standalone-motor Standalone Motor
travel Travel
travel-introducer Travel Introducer
vet Vet