fingerprint / fingerprint-pro-server-api-sdk
Fingerprint Pro Server API provides a way for validating visitors’ data issued by Fingerprint Pro.
Installs: 26 004
Dependents: 0
Suggesters: 0
Security: 0
Stars: 16
Watchers: 9
Forks: 5
Open Issues: 0
Requires
- php: >=7.1
- ext-curl: *
- ext-json: *
- ext-mbstring: *
- ext-openssl: *
- ext-zlib: *
- guzzlehttp/guzzle: ~7.2
Requires (Dev)
- friendsofphp/php-cs-fixer: ~2.19
- phpunit/phpunit: 8.5.33
- squizlabs/php_codesniffer: ~2.6
README
Fingerprint Pro Server API PHP SDK
Fingerprint Pro Server API allows you to get information about visitors and about individual events in a server environment. It can be used for data exports, decision-making, and data analysis scenarios. Server API is intended for server-side usage, it's not intended to be used from the client side, whether it's a browser or a mobile device.
This PHP package is automatically generated by the Swagger Codegen project:
- API version: 3
- Package version: 4.1.0
- Build package: io.swagger.codegen.v3.generators.php.PhpClientCodegen
Requirements
This library supports the following PHP implementations:
- PHP 8.1
- PHP 8.2
- PHP 8.3
We currently don't support external PHP Runtimes like:
- Bref
- ReactPHP
Installation & Usage
Composer
To install the bindings via Composer, add the following to composer.json
:
{
"require": {
"fingerprint/fingerprint-pro-server-api-sdk": "dev-main"
}
}
Then run composer install
.
Or you can just run this command on your terminal:
composer require fingerprint/fingerprint-pro-server-api-sdk
Getting Started
Please follow the installation procedure and then run the following:
<?php require_once(__DIR__ . '/vendor/autoload.php'); // Fingerprint Pro Secret API Key const FPJS_API_SECRET = "Fingerprint Pro Secret API Key"; // A mandatory visitorId of a specific visitor const FPJS_VISITOR_ID = "visitorId"; // An optional requestId made by a specific visitor const FPJS_REQUEST_ID = "requestId"; // An optional linkedId of the visit const FPJS_LINKED_ID = "linkedId"; // An optional parameter limiting scanned results const LIMIT = 10; // An optional parameter used to paginate results, see lastTimestamp const PAGINATION_KEY = "1683900801733.Ogvu1j"; // Import Fingerprint Pro Classes and Guzzle Http Client use Fingerprint\ServerAPI\Api\FingerprintApi; use Fingerprint\ServerAPI\Configuration; use GuzzleHttp\Client; // Create a new Configuration instance with your Fingerprint Pro Server API Key and your Fingerprint Pro Server API Region. /** * You can specify a region on getDefaultConfiguration function's second parameter * If you leave the second parameter empty, then Configuration::REGION_GLOBAL will be used as a default region * Options for regions are: * Configuration::REGION_EUROPE * Congiruration::REGION_GLOBAL * Configuration::REGION_ASIA */ $config = Configuration::getDefaultConfiguration(FPJS_API_SECRET, Configuration::REGION_EUROPE); $client = new FingerprintApi( new Client(), $config ); // Get an event with a given requestId try { // Fetch the event with a given requestId $response = $client->getEvent(FPJS_REQUEST_ID); echo "<pre>" . $response->__toString() . "</pre>"; } catch (Exception $e) { echo 'Exception when calling FingerprintApi->getEvent: ', $e->getMessage(), PHP_EOL; } // Get a specific visitor's all visits try { // Fetch all visits with a given visitorId, with a page limit $response = $client->getVisits(FPJS_VISITOR_ID, null, null, LIMIT); echo "<pre>" . $response->__toString() . "</pre>"; } catch (Exception $e) { echo 'Exception when calling FingerprintApi->getEvent: ', $e->getMessage(), PHP_EOL; } // Get a specific visitor's all visits with a linkedId try { // Fetch all visits with a given visitorId, with a page limit, skipping the first visit $response = $client->getVisits(FPJS_VISITOR_ID, null, FPJS_LINKED_ID, LIMIT, PAGINATION_KEY); echo "<pre>" . $response->__toString() . "</pre>"; } catch (Exception $e) { echo 'Exception when calling FingerprintApi->getEvent: ', $e->getMessage(), PHP_EOL; } // Use all the parameters on getVisits try { // Fetch the visitor's all visits with a given requestId and linkedId with a page limit while skipping the first visit $response = $client->getVisits(FPJS_VISITOR_ID, FPJS_REQUEST_ID, FPJS_LINKED_ID, LIMIT, PAGINATION_KEY); echo "<pre>" . $response->__toString() . "</pre>"; } catch (Exception $e) { echo 'Exception when calling FingerprintApi->getEvent: ', $e->getMessage(), PHP_EOL; }
Sealed results
This SDK provides utility methods for decoding sealed results.
<?php use Fingerprint\ServerAPI\Sealed\DecryptionAlgorithm; use Fingerprint\ServerAPI\Sealed\DecryptionKey; use Fingerprint\ServerAPI\Sealed\Sealed; require_once(__DIR__ . '/vendor/autoload.php'); $sealed_result = base64_decode($_ENV['BASE64_SEALED_RESULT']); $sealed_key = base64_decode($_ENV['BASE64_KEY']); try { $data = Sealed::unsealEventResponse($sealed_result, [new DecryptionKey($sealed_key, DecryptionAlgorithm::AES_256_GCM)]); fwrite(STDOUT, sprintf("Unsealed event: %s \n", $data)); } catch (Exception $e) { fwrite(STDERR, sprintf("Exception when unsealing event: %s\n", $e->getMessage())); exit(1); }
To learn more, refer to example located in sealed_results_example.php.
Documentation for API Endpoints
All URIs are relative to your region's base URL.
Region | BasePath |
---|---|
US / Global | https://api.fpjs.io |
Europe | https://eu.api.fpjs.io |
Asia | https://ap.api.fpjs.io |
Endpoints
Class | Method | HTTP request | Description |
---|---|---|---|
FingerprintApi | getEvent | GET /events/{request_id} | Get event by requestId |
FingerprintApi | getVisits | GET /visitors/{visitor_id} | Get visits by visitorId |
Documentation for Models
- ASN
- BotdDetectionResult
- BotdResult
- BrowserDetails
- ClonedAppResult
- Confidence
- DataCenter
- DeprecatedIPLocation
- DeprecatedIPLocationCity
- EmulatorResult
- ErrorEvent403Response
- ErrorEvent403ResponseError
- ErrorEvent404Response
- ErrorEvent404ResponseError
- ErrorVisits403
- EventResponse
- FactoryResetResult
- FridaResult
- HighActivityResult
- IPLocation
- IPLocationCity
- IdentificationError
- IncognitoResult
- IpBlockListResult
- IpBlockListResultDetails
- IpInfoResult
- IpInfoResultV4
- IpInfoResultV6
- JailbrokenResult
- Location
- LocationSpoofingResult
- ManyRequestsResponse
- PrivacySettingsResult
- ProductError
- ProductsResponse
- ProductsResponseBotd
- ProductsResponseIdentification
- ProductsResponseIdentificationData
- ProxyResult
- RawDeviceAttributesResult
- Response
- ResponseVisits
- RootAppsResult
- SeenAt
- SignalResponseClonedApp
- SignalResponseEmulator
- SignalResponseFactoryReset
- SignalResponseFrida
- SignalResponseHighActivity
- SignalResponseIncognito
- SignalResponseIpBlocklist
- SignalResponseIpInfo
- SignalResponseJailbroken
- SignalResponseLocationSpoofing
- SignalResponsePrivacySettings
- SignalResponseProxy
- SignalResponseRawDeviceAttributes
- SignalResponseRootApps
- SignalResponseSuspectScore
- SignalResponseTampering
- SignalResponseTor
- SignalResponseVirtualMachine
- SignalResponseVpn
- Subdivision
- SuspectScoreResult
- TamperingResult
- TorResult
- VirtualMachineResult
- Visit
- VpnResult
- VpnResultMethods
- WebhookVisit
Documentation for Authorization
ApiKeyHeader
- Type: API key
- API key parameter name: Auth-API-Key
- Location: HTTP header
ApiKeyQuery
- Type: API key
- API key parameter name: api_key
- Location: URL query string
Documentation for sealed results
Tests
To run the unit tests:
composer install
./vendor/bin/phpunit
Support
To report problems, ask questions or provide feedback, please use Issues. If you need private support, you can email us at oss-support@fingerprint.com.
License
This project is licensed under the MIT License.