Ask Kodiak JS
Table of Contents
Overview
Ask Kodiak JS is a dependency free implementation of the Ask Kodiak API for browser environments. API Keys are required to use, you can obtain those keys from Company Settings once you've created an account.
Installation
Ask Kodiak JS is available on npm as ask-kodiak-js
.
$ npm install --save ask-kodiak-js
Basic Usage
To use Ask Kodiak JS, include the JavaScript file in your page, instantiate, and go.
Ask Kodiak JS supports using either Promises or callback functions (default).
Promises are not supported natively in any version of Internet Explorer, so if you choose to enable promises in your implementation and want to support IE, you'll need to implement a polyfill like https://github.com/taylorhakes/promise-polyfill.
Use Callbacks
Or, Use Promises
API Key Security
Your API keys give read access to your content on Ask Kodiak. Be sure to keep them safe. If you consider the information your company has added to Ask Kodiak sensitive, be sure to keep these keys behind a login screen in your app.
Request Parameters
For any API request that supports optional request parameters, pass an options
object to the method with those values. For example, if making a request where it's important to filter by geography and owner, you would pass the following options
object to the method:
'geos': 'US-MN+US-HI' 'owners': 'ABC123'
Contributing
Please refer to the CONTRIBUTING page for more information about how you can contribute to this project. We welcome bug reports, feature requests, code review feedback, and also pull requests.
Supported Environments
Ask Kodiak JS supports all major modern browsers. If you choose to enable Ask Kodiak JS Promise support in your implementation and intend to support Internet Explorer, you'll need to implement a polyfill like https://github.com/taylorhakes/promise-polyfill.
Upgrading
Version 2 brings with it breaking changes. Make sure to review the Ask Kodiak API Upgrade Guide before upgrading.
Changes to this library:
- added Product method
getConditionalRules
. - removed Company method
getCompanyProfile
. - added Company method
getCompany
(replaces the above). - added Analytics method
getReferrals
. - added Analytics method
getReferral
. - removed Reference Data method
getRefDataStates
. - added Reference Data method
getRefDataGeos
(replaces the above).
Documentation
For a full list of options supported by each interface, see the Ask Kodiak API documentation.
Products
Products for Code
Get products eligible for a given NAICS code. https://api.askkodiak.com/doc/v2/#api-Products-GetProductsForNAICSCode
Using Callbacks
//return all products for the retail sectoraskKodiak; // alternative example, all products for the retail sector for companies with 1,000,000 in annual revenue// any valid optional request parameter for this interface can be passed in the options object.askKodiak;
Using Promises
//return all products for the retail sectoraskKodiak;
Products for Company
Get products for a given Company. https://api.askkodiak.com/doc/v2/#api-Products-GetProductsForCompany
Using Callbacks
//return all products owned by the company with id -Nj840c1sd9nnByhoaskKodiak //return all BOP products owned by the company with id -Nj840c1sd9nnByhoaskKodiak;
Using Promises
//return all BOP products owned by the company with id -Nj840c1sd9nnByhoaskKodiak;
Product
Get Product
Return a product with the specified id. https://api.askkodiak.com/doc/v2/#api-Product-GetProduct
Using Callbacks
askKodiak;
Using Promises
askKodiak;
Check Eligibility for NAICS Code
Check the eligibility of a product for any valid 2-6 digit NAICS code or computed NAICS Hash. https://api.askkodiak.com/doc/v2/#api-Product-ProductIsEligibleForNAICSCode
Using Callbacks
askKodiak;
Using Promises
askKodiak;
Get Eligibility By NAICS Group Type
Get the eligibility of a product at a given NAICS group level (sector
, subsector
, etc).https://api.askkodiak.com/doc/v2/#api-Product-ProductEligibilityByNAICSGroupType
Using Callbacks
askKodiak;
Using Promises
askKodiak;
Render Conditional Content
Render conditional content for the product associated with the specified conditions. https://api.askkodiak.com/doc/v2/#api-Product-RenderConditionalContent
Using Callbacks
askKodiak;
Using Promises
askKodiak;
Get Conditional Rules
Get unprocessed conditional rules for the requested product. Please note, this interface exists primarily for debugging. The rules expressed in the response are automatically applied to other product interfaces based on the parameters of the specific request. This interface simply provides a getter for all the rules that have been specified for a product. https://api.askkodiak.com/doc/v2/#api-Product-GetConditionalRulesForProduct
Using Callbacks
askKodiak;
Using Promises
askKodiak;
Company
Get Companies
Get the basic information about companies with storefronts on Ask Kodiak, including their name, website, and other descriptive information as available. https://api.askkodiak.com/doc/v2/#api-Company-GetCompanies
Using Callbacks
askKodiak
Using Promises
askKodiak;
Get Company
Get the basic information about a company on Ask Kodiak. https://api.askkodiak.com/doc/v2/#api-Company-GetCompany
Using Callbacks
// get the profile of the company by it's idaskKodiak;
Using Promises
askKodiak;
NAICS
Get Code
Decode a NAICS MD5 hash into the 6 digit naics code and sub-description it represents. https://api.askkodiak.com/doc/v2/#api-NAICS-GetNaicsCode
Using Callbacks
askKodiak;/* { code: '621511', description: 'Pathology laboratories, medical', hash: '0000dc045c872f122d694ef600c394df' }*/
Using Promises
askKodiak;
Get Codes
Get all computed NAICS hashes. Heads up, this is a big hunk of data. We recommend that you cache a copy on your end for best performance. https://api.askkodiak.com/doc/v2/#api-NAICS-GetNaicsCodes
Using Callbacks
askKodiak;
Using Promises
askKodiak;
Get Description
Get a description for a NAICS group. https://api.askkodiak.com/doc/v2/#api-NAICS-GetNaicsDescription
Using Callbacks
askKodiak;
Using Promises
askKodiak;
Get Group
Get any given NAICS group using its numerical group number. https://api.askkodiak.com/doc/v2/#api-NAICS-GetNaicsGroup
Using Callbacks
askKodiak;
Using Promises
askKodiak;
Get Path
Given a code, return it's NAICS parentage. https://api.askkodiak.com/doc/v2/#api-NAICS-GetNaicsGroupPath
Using Callbacks
//As Array...askKodiak; //{ path: [ '48-49', '488', '4881', '48819', '488190' ] // As Object...askKodiak;/* { sector: '48-49', subsector: '488', industryGroup: '4881', internationalIndustry: '48819', nationalIndustry: '488190' } */
Using Promises
//As Array...askKodiak; // As Object...askKodiak;
Get Sectors
Get detailed information about all NAICS sectors. Heads up, this is a big hunk of data. We recommend that you cache a copy on your end for best performance. https://api.askkodiak.com/doc/v2/#api-NAICS-GetNaicsSectors
Using Callbacks
askKodiak;
Using Promises
askKodiak;
Get Summary for Group Type
Get a comprehensive list of all valid naics groups of the requested type. https://api.askkodiak.com/doc/v2/#api-NAICS-GetNAICSSummaryForGroupType
Using Callbacks
askKodiak;/* { '11': 'Agriculture, Forestry, Fishing and Hunting', '21': 'Mining, Quarrying, and Oil and Gas Extraction', '22': 'Utilities', '23': 'Construction', '42': 'Wholesale Trade', '51': 'Information', '52': 'Finance and Insurance', '53': 'Real Estate and Rental and Leasing', '54': 'Professional, Scientific, and Technical Services', '55': 'Management of Companies and Enterprises', '56': 'Administrative and Support and Waste Management and Remediation Services', '61': 'Educational Services', '62': 'Health Care and Social Assistance', '71': 'Arts, Entertainment, and Recreation', '72': 'Accommodation and Food Services', '81': 'Other Services (except Public Administration)', '92': 'Public Administration', '31-33': 'Manufacturing', '44-45': 'Retail Trade', '48-49': 'Transportation and Warehousing' } */
Using Promises
askKodiak;
Get Summary
Get a comprehensive list of all valid naics groups indexed by type (e.g. sector, subsector, industry-group, international-industry, or national-industry). https://api.askkodiak.com/doc/v2/#api-NAICS-GetNAICSSummary
Using Callbacks
askKodiak;
Using Promises
askKodiak;
Admin
Products
Get products owned by your your group regardless of their permission. https://api.askkodiak.com/doc/v2/#api-Admin-AdminGetProducts.
Using Callbacks
// all productsaskKodiak; // all products with eligibility in VAaskKodiak;
Using Promises
// all productsaskKodiak; // all products with eligibility in VAaskKodiak;
Analytics
Track Event
Track an event (for example a search or a user action). https://api.askkodiak.com/doc/v2/#api-Analytics-TrackEvent
Using Callbacks
// track an event with the name 'inbound-referral' and pass it the specified dataaskKodiak;
Using Promises
// track an event with the name 'inbound-referral' and pass it the specified dataaskKodiak;
Get Referrals
Retrieve all of your groups referrals from Ask Kodiak. https://api.askkodiak.com/doc/v2/#api-Analytics-GetReferrals
Using Callbacks
askKodiak
Using Promises
askKodiak;
Get Referral
Retrieve the details of a referral using it's id. https://api.askkodiak.com/doc/v2/#api-Analytics-GetReferral
Using Callbacks
askKodiak;
Using Promises
askKodiak;
Reference Data
Business Entity Types
Get a list of business entity types for use decoding the coded values associated with a product. https://api.askkodiak.com/doc/v2/#api-Reference_Data-BusinessEntityTypes
Using Callbacks
askKodiak;/* { AS: 'Association', CA: 'Condo Association', CC: 'City Commission', CCORP: 'C Corporation', ... }*/
Using Promises
askKodiak;
Product Codes
Get a list of product codes for use decoding the coded values associated with a product. https://api.askkodiak.com/doc/v2/#api-Reference_Data-ProductCodes
Using Callbacks
askKodiak; /*{ ACCT: 'Accountants Professional', ACHE: 'Accident and Health', AGENTS: 'Insurance Agents', AGLIA: 'Agriculture Liability', ...}*/
Using Promises
askKodiak;
Geographies
Get geographies supported by Ask Kodiak as objects indexed by an ISO 3166-2 code. For more information on the ISO 3166 standard, see https://www.iso.org/iso-3166-country-codes.html. https://api.askkodiak.com/doc/v2/#api-Reference_Data-Geographies
Using Callbacks
askKodiak;
Using Promises
askKodiak;
Suggest
If your application has a scenario where the user needs to type in a NAICS code, these interfaces are great for making suggestions in a type-ahead control.
Naics Codes
Get suggested hashes associated with a search term. https://api.askkodiak.com/doc/v2/#api-Suggest-NAICSCodes
Using Callbacks
// returns 20 hits...askKodiak; // returns 100 hits...askKodiak;
Using Promises
// returns 20 hits...askKodiak; // returns 100 hits...askKodiak;
Naics Groups
Get suggested 2-6 digit NAICS groups for a search term. https://api.askkodiak.com/doc/v2/#api-Suggest-NAICSGroups
Using Callbacks
// returns 20 hits...askKodiak; // page three of results 5 pages at a time..askKodiak;
Using Promises
// returns 20 hits...askKodiak; // page three of results 5 pages at a time..askKodiak;