承接 olsgreen/autotrader-api 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

olsgreen/autotrader-api

Composer 安装命令:

composer require olsgreen/autotrader-api

包简介

This package provides a means easily of interacting with the Auto Trader API.

README 文档

README

Latest Version Software License

This package provides a means easily of interacting with the AutoTrader API.

Installation

Add the client to your project using composer.

composer require olsgreen/autotrader-api

Usage

AutoTrader require that you exchange your key & secret for an access token, this is then used to access the API.

Authentication

// Create an instance of the client to obtain an access token.
$api = new \Olsgreen\AutoTrader\Client();
$accessToken = $api->authentication()->getAccessToken('YOUR_KEY', 'YOUR_SECRET');

// once you have your access token you can create client instances like:
$api = new \Olsgreen\AutoTrader\Client(['access_token' => $accessToken]);

Vehicles

This endpoint is used to look up UK registered vehicles and returns core vehicle data.

Lookup base information

Retrieves the vehicles base information data for a valid UK registration (VRM).

$vehicle = $api->vehicles()->lookup('123456', 'HG17XXX');

/*
 * Will return something similar to the below.
 * 
 * [
 *     "vehicle" => [
 *       "ownershipCondition" => "Used",
 *       "registration" => "HG17XXX",
 *       "vin" => "WMWWG320503CXXXXX",
 *       "make" => "MINI",
 *       "model" => "Convertible",
 *       "generation" => "Convertible (2015 - 2018)",
 *       "derivative" => "1.5 Cooper Convertible 2dr Petrol (s/s) (136 ps)",
 *       "derivativeId" => "5b746c3a24974b8fa1048b0141356a34",
 *       "vehicleType" => "Car",
 *       "trim" => "Cooper",
 *       "bodyType" => "Convertible",
 *       "fuelType" => "Petrol",
 *       "cabType" => null,
 *       "transmissionType" => "Manual",
 *       ...
 *       ],
 *     ],
 *   ]
 *
 * For the full response see:
 * https://developers.autotrader.co.uk/documentation#vehicle-base-information
 */

Extended lookups

You can retrieve extra datasets for a VRM via the lookup method by supplying the one or all of the following flags:

Note: The VehicleLookupFlags::VEHICLE_METRICS & VehicleLookupFlags::VALUATIONS flags also require the current mileage to be passed in as the last parameter as below.

  • VehicleLookupFlags::MOT_TESTS

    Provides most recent MOT test information for the specified vehicle.

  • VehicleLookupFlags::FEATURES

    Provides an array of standard and possible optional features for the specified vehicle.

  • VehicleLookupFlags::BASIC_VEHICLE_CHECK

    Provides a variety of vehicle specific provenance data.

  • VehicleLookupFlags::FULL_VEHICLE_CHECK

    Provides a variety of vehicle specific provenance data.

  • VehicleLookupFlags::VALUATIONS

    Provides a variety of Auto Trader valuations for the specified vehicle.

  • VehicleLookupFlags::VEHICLE_METRICS

    Provides a variety of Auto Trader valuations and vehicle metrics for the specified vehicle.

  • VehicleLookupFlags::COMPETITORS

    Provides a pre-constructed URL, allowing users to explore market competition.

// For example, to retrieve the MOT & basic vehicle check datasets
// we can do the following:

use Olsgreen\AutoTrader\Api\Builders\LookupRequestBuilder;

$request = LookupRequestBuilder::create()
    ->setRegistration('EO66XXX')
    ->setFlags([
        VehicleLookupFlags::BASIC_VEHICLE_CHECK, 
        VehicleLookupFlags::VEHICLE_METRICS
    ]);

$vehicle = $api->vehicles()->lookup($request);

/*
 * Will return something similar to the below.
 * 
 * [
 *     "vehicle" => [
 *       "ownershipCondition" => "Used",
 *       "registration" => "EO66XXX",
 *       "vin" => "WMWWG320503CXXXXX",
 *       "make" => "MINI",
 *       "model" => "Convertible",
 *       "generation" => "Convertible (2015 - 2018)",
 *       "derivative" => "1.5 Cooper Convertible 2dr Petrol (s/s) (136 ps)",
 *       "derivativeId" => "5b746c3a24974b8fa1048b0141356a34",
 *       "vehicleType" => "Car",
 *       "trim" => "Cooper",
 *       "bodyType" => "Convertible",
 *       "fuelType" => "Petrol",
 *       "cabType" => null,
 *       "transmissionType" => "Manual",
 *       ...
 * 
 *       "check" => [
 *           "insuranceWriteoffCategory" => null,
 *           "scrapped" => false,
 *           "stolen" => false,
 *           "imported" => false,
 *           "exported" => false,
 *           "previousOwners" => 1,
 *           "keeperChanges" => [
 *               [
 *                 "dateOfLastKeeper" => "2020-07-14",
 *               ],
 *           ],
 *           "v5cs" => [
 *               [
 *                 "issuedDate" => "2017-06-30",
 *               ],
 *           ],
 *       ],
 * 
 *      "motTests" => [
 *           [
 *               "completedDate" => "2020-06-26T10:05:59Z",
 *               "expiryDate" => "2021-06-25",
 *               "testResult" => "Passed",
 *               "odometerValue" => 16330,
 *               "odometerUnit" => "Miles",
 *               "motTestNumber" => "444811158817",
 *               "rfrAndComments" => [],
 *           ],
 *           ...
 *       ],
 *     ],
 *   ]
 *
 * For the full responses see:
 * https://developers.autotrader.co.uk/documentation#vehicle-base-information
 */

olsgreen/autotrader-api 适用场景与选型建议

olsgreen/autotrader-api 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 9.84k 次下载、GitHub Stars 达 10, 最近一次更新时间为 2021 年 04 月 12 日, 在 PHP 生态内属于活跃度较高的组件。

我们在过去多个企业项目中使用过 olsgreen/autotrader-api 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。

围绕 olsgreen/autotrader-api 我们能提供哪些服务?
定制开发 / 二次开发

基于 olsgreen/autotrader-api 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。

BUG 修复 & 性能优化

线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。

项目外包 & 长期维护

承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。

yvsm@zunyunkeji.com QQ:316430983 微信:yvsm316 西安尊云信息科技 · 专注 PHP / Go / 分布式系统研发

统计信息

  • 总下载量: 9.84k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 10
  • 点击次数: 27
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 10
  • Watchers: 4
  • Forks: 4
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2021-04-12