Dealer Contact

This API allows you to update the contact details, such as email address or phone number, for a specific dealer


The Dealer Contact Resource

Properties

  • Name
    id
    Required
    Type
    integer
    Description

    Unique identifier for the dealer contact record. This is not the dealer ID.

  • Name
    dealer_id
    Required
    Type
    integer
    Description

    The unique ID for the dealer.

  • Name
    methods
    Required
    Type
    array<ContactMethodResource>
    Description

    An array of contact methods for this dealer. Only available contact methods will be returned.

  • Name
    dates.created_at
    Required
    Type
    datetime
    Description

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

  • Name
    dates.updated_at
    Required
    Type
    datetime
    Description

    The date the dealer's contact record was last updated, represented in YYYY-MM-DD HH:MM:SS format

  • Name
    dates.deleted_at
    Required
    Type
    null | datetime
    Description

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

Dealer Contact Resource

{
  "id": 1,
  "dealer_id": 12345,
  "methods": [
    {
      "type": "phone_number",
      "value": "07777777777"
    },
    {
      "type": "email",
      "value": "support@itccompliance.co.uk"
    }
  ],
  "dates": {
    "created_at": "2024-01-01 00:00:00",
    "updated_at": "2024-01-02 12:00:00",
    "deleted_at": null,
  }
}

The Contact Method Resource

Properties

  • Name
    type
    Required
    Type
    string
    Description

    The contact method available. One of phone_number, email, 'website'.

  • Name
    value
    Required
    Type
    string
    Description

    The contact method value for the type, such as the actual email address or phone number.

Contact Method Resource

{
  "type": "email",
  "value": "07777777777",
}

GET/v2/dealers/:dealer_id/contact

Retrieve Contact Record

Will retrieve a specific dealers contact record. If the dealer has no contact methods listed, a successful response will be returned, but will contain no methods.

URL Parameters

  • Name
    dealer_id
    Required
    required
    Type
    integer
    Description

    ID of the dealer to retrieve

Error Codes

Status Description
404 The requested dealer could not be found

Request

GET
/v2/dealers/:dealer_id/contact
use Compliance\Sdk\ApexV3\Contracts\ApexV3SdkInterface;
use Compliance\Sdk\Authentication\Types\Machine;

private ApexV3SdkInterface $sdk;

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

Response

{
  "data": {
    "id": 1,
    "dealer_id": 12345,
    "methods": [
      {
        "type": "phone_number",
        "value": "07777777777"
      }
    ],
    "dates": {
      "created_at": "2024-01-01 00:00:00",
      "updated_at": "2024-01-02 00:00:00",
      "deleted_at": null,
    }
  }
}

PUT/v2/dealers/:dealer_id/contact

Update Contact Method

Will attempt to update the the contact method for a dealer

URL Parameters

  • Name
    dealer_id
    Required
    required
    Type
    integer
    Description

    ID of the dealer to update

Payload

  • Name
    methods
    Required
    Type
    array<ContactMethodResource>
    Description

    An array of contact method resources to update.

Error Codes

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

Request

PUT
/v2/dealers/:dealer_id/contact
use Compliance\Sdk\ApexV3\Contracts\ApexV3SdkInterface;
use Compliance\Sdk\Authentication\Types\Machine;

private ApexV3SdkInterface $sdk;

// To update a single contact method
$response = $this->sdk
  ->v2(new Machine())
  ->dealer(1)
  ->contactDetails()
  ->updateContactMethod(1, 'phone_number', '07777777777');

// To remove a contact method
$response = $this->sdk
  ->v2(new Machine())
  ->dealer(1)
  ->contactDetails()
  ->removeContactMethod(1, 'phone_number');

// To update multiple contact methods
$response = $this->sdk
  ->v2(new Machine())
  ->dealer(1)
  ->updateContactMethods([
    [
      'type' => 'phone_number',
      'value' => '007777777777',
    ]
  ]);

Response

{
  "data": {
    "id": 1,
    "dealer_id": 12345,
    "methods": [
      {
        "type": "phone_number",
        "value": "07777777777"
      }
    ],
    "dates": {
      "created_at": "2024-01-01 00:00:00",
      "updated_at": "2024-01-02 00:00:00",
      "deleted_at": null,
    }
  }
}