Overview

This guide will take you through the minimum required steps to begin making API requests. By the end of this guide, you’ll be able to retrieve the closest gun dealer(s) list with all the required information. Before we begin, here are a few key concepts:

  • API requests require a token to get data, and API tokens are issued on a per-site basis. You may register for a free trial which will automatically expire after 14 days.
  • API Credentials can be generated from user control panel. If you are testing requests  for a single site, start here to quickly get your token and begin making API calls.

Prerequisites

About Our API

Want to make API Requests right away? Check out the Authentication.

FFL API allows you to get the closest and active gun dealers’ list by the given zip code and radius information for license details and store address.

Authentication

You need to get API credentials that are available to developers wishing to make requests against FFL API:

API Credentials (created in a user control panel)

FFL API Credentials are generated when a FFL API Developer Account is created in user control panel (API Keys > Generate Key). These credentials are used to programmatically interact with an api.

Accessibility

Our team frequently enhances its core product and is actively developing  API endpoints. By using the newest API version, you will ensure that your app has access to the latest resources.

Code Examples

//you need to use below example with GuzzleHttp package

use GuzzleHttp;

$client = new GuzzleHttp\Client(['base_uri' => 'https://app.fflapi.com/v1/']);

try {


    $response = $client->request('POST', 'get-ffl', [
            'headers' => [
                'Content-Type' => 'application/json', //required header
                'X-Requested-With'     => 'XMLHttpRequest', //required header
                'X-Authorization'      => 'Your API key' //required header - your API key that generated
            ],
            'json' => [
                'zipcode' => '33133', // zipcode
                'radius' => '5' // mile , you can set between 1 and 100
            ]
    ]);

    $fflLists = json_decode($response->getBody()->getContents());


    foreach ($fflLists as $ffl)
    {
        /*
        * returned parameters are :
        license_number,
        license_name,
        business_name,
        premise_street,
        premise_city,
        premise_state,
        premise_zip_code
        */

        print_r($ffl);
    }

} catch (GuzzleHttp\Exception\ClientException $exception) {
    $response = $exception->getResponse();
    $responseBodyAsString = $response->getBody()->getContents();

    echo ($responseBodyAsString);
}
//you need to use below example with GuzzleHttp package

use GuzzleHttp;

$client = new GuzzleHttp\Client(['base_uri' => 'https://app.fflapi.com/v1/']);

try {


    $response = $client->request('POST', 'validate-ffl', [
            'headers' => [
                'Content-Type' => 'application/json', //required header
                'X-Requested-With'     => 'XMLHttpRequest', //required header
                'X-Authorization'      => 'Your API key' //required header - your API key that generated
            ],
            'json' => [
                'licence' => '9-99-99999' //needs only enter the first 3 digits and the last 5 digits of the FFL
            ]
    ]);

    $ffl = json_decode($response->getBody()->getContents());


print_r($ffl);
/*Response :
 "exp": "2021-06-01",
 "active": true,
        "licence": "9-99-99999"
 */ 

} catch (GuzzleHttp\Exception\ClientException $exception) {
    $response = $exception->getResponse();
    $responseBodyAsString = $response->getBody()->getContents();

    echo ($responseBodyAsString);
}
//add container where if you want to show widget
 

//add before our js sdk your page’s b body tag //add that script and initialize widget with parameters

Integrations

BigCommerce and WooCommerce App Integrations Coming Soon

Error Codes

Status Code Reason
400
The request could not be understood by the server due to malformed syntax.
422
The server understands the content type of the request entity and the syntax of the request entity is correct but was unable to process the contained instructions.
500
The usage limit for your application has been exceeded for the hour time period.