fasttrack/fasttrack-client

This Fasttrack library enables you to request the Fasttrack API in a convenient way. For more information about the Fasttrack API please see https://api.fasttrack-intl.com

1.4 2017-07-24 13:58 UTC

This package is not auto-updated.

Last update: 2024-05-17 18:04:35 UTC


README

Installation

Add to your composer.json:

{
    "require": {
        "fasttrack/fasttrack-client": "*"
    }
}

And do:

composer install

Usage

Get company

<?php
require 'vendor/autoload.php';

use Fasttrack\Fasttrack;

$client = new \Fasttrack\Fasttrack('your_token');

try {
  $company = $client->getCompany('example.com');
  print_r($company);
} catch (Exception $err) {
  print_r($err);
}

?>

Get contact

<?php
require 'vendor/autoload.php';

use Fasttrack\Fasttrack;

$client = new \Fasttrack\Fasttrack('your_token');

try {
  $company = $client->getContact('example@example.com');
  print_r($company);
} catch (Exception $err) {
  print_r($err);
}

?>

Error handling

<?php
require 'vendor/autoload.php';

use Fasttrack\Fasttrack;
use Fasttrack\Exceptions;

$client = new \Fasttrack\Fasttrack('your_token');

try {
  $company = $client->getContact('example@example.com');
  print_r($company);
} catch (\Fasttrack\Exceptions\UnauthorizedException $e) {
  print_r('UnauthorizedException');
}

?>

Available exceptions

  • BadParametersException: send parameters through GET method
  • BadRequestException: request is malformed
  • InternalServerException
  • InvalidVersionException: API version is invalid
  • MethodNotAllowedException: you tried to access an endpoint with an invalid method
  • NoResultException: no result matching your request
  • NotAcceptableException: you requested a format that is not json
  • NotFoundException: specified endpoint could not be found
  • TooManyRequestsException: you made too many requests on the API in a short period of time
  • UnauthorizedException: API key is wrong
  • VersionRequiredException: send API version in the HTTP Accept headers