search mobile facets autocomplete spellcheck crawler rankings weights synonyms analytics engage api customize documentation install setup technology content domains user history info home business cart chart contact email activate analyticsalt analytics autocomplete cart contact content crawling custom documentation domains email engage faceted history info install mobile person querybuilder search setup spellcheck synonyms weights engage_search_term engage_related_content engage_next_results engage_personalized_results engage_recent_results success add arrow-down arrow-left arrow-right arrow-up caret-down caret-left caret-right caret-up check close content conversions-small conversions details edit grid help small-info error live magento minus move photo pin plus preview refresh search settings small-home stat subtract text trash unpin wordpress x alert case_deflection advanced-permissions keyword-detection predictive-ai sso

App Search API Clients

To enjoy the clients, one needs an active App Search account. Sign up for a free trial.


Swiftype App Search has an assortment of official API clients. You will need to have an active account with at least one available engine in order to put the clients to work. Below you will find repository links and basic configuration details for...

Ruby

GitHub repository

The App Search API has an official Ruby client. It is hosted by RubyGems.org and has no dependencies.

You will need to have an active Swiftype account with at least one available engine. No account? Sign up here.
Installation

You can install the gem:

$ gem install swiftype-app-search

Alternatively, you can place gem 'swiftype-app-search', '~> x.x.x into your Gemfile and run bundle install.

Configuration

To configure the gem, you will need two items from the API Keys menu. You can find that menu within your App Search dashboard under Access.

First, you will need your [HOST_IDENTIFIER]. This key represents the unique hostname that belongs to your Swiftype account.

The second thing you will need is your [API_KEY]. This key is needed for authentication.

client = SwiftypeAppSearch::Client.new(:host_identifier => '[HOST_IDENTIFIER]', :api_key => '[API_KEY]')

You can now access the App Search API from within your Ruby application code.

Check out the GitHub repository for further information on available methods, testing, and debugging.

Java

GitHub repository

The App Search API has an official Java client. However, the client is not published to any public repositories and will need to be installed manually. You can find the latest builds within GitHub here.

You will need to have an active Swiftype account with at least one available engine. No account? Sign up here.
Installation

To install the Java client, you must build it locally. To accomplish this, you will need two items from the API Keys menu. You can find that menu within your App Search dashboard under Access.

First, you will need your [HOST_IDENTIFIER]. This key represents the unique hostname that belongs to your Swiftype account.

The second thing you will need is your [API_KEY]. This key is needed for authentication.

From the command line, run the following build command:

$ ST_APP_SEARCH_HOST_KEY="[HOST_IDENTIFIER]" ST_APP_SEARCH_API_KEY="[API_KEY]" gradle build shadowjar

The output will be two .jar files. The first - swiftype-app-search-<version>-all.jar - includes all necessary dependencies. The second - swiftype-app-search-<version>.jar - includes only the client code.

Configuration

To configure the App Seach Java client you will need to import it within your application code. To do this, you will need to attach your [HOST_IDENTIFIER] and [API_KEY] to variables for the client to access.

import com.swiftype.appsearch.Client;

String hostIdentifier = "[HOST_IDENTIFIER]";
String apiKey = "[API_KEY]";
Client client = new Client(hostIdentifier, apiKey);

Check out the GitHub repository for further information on available methods and testing.

JavaScript

GitHub repository

The App Search API has an official JavaScript client. The package is hosted within npmjs.com. You have two ways that you can install it within your code-base.

You will need to have an active Swiftype account with at least one available engine. No account? Sign up here.
Installation

One option is to install the script, which is hosted via the jsDelivr content delivery network:

<script src="https://cdn.jsdelivr.net/npm/swiftype-app-search-javascript@1.0.3"></script>

Using this script, the client becomes globally available at window.SwiftypeAppSearch.

Another option is to install the client's package using NPM:

npm install --save swiftype-app-search-javascript

With the package, you can then bring it into your application code:

// CommonJS
var SwiftypeAppSearch = require('swiftype-app-search-javascript')

// ES
import * as SwiftypeAppSearch from 'swiftype-app-search-javascript'
Configuration

To utilize the App Search JavaScript API Client, you will need the name of your Engine and two items from the API Keys menu. You can find that menu within your App Search dashboard under Access.

First, you will need your [HOST_IDENTIFIER]. This key represents the unique hostname that belongs to your Swiftype account.

The second thing you will need is your [SEARCH_KEY]. This key is needed for authentication. As best practice when running code on the browser, you will want to use your read-only API Key, which is your [SEARCH_KEY], instead of your [API_KEY]. More information on API Keys can be found here.

var client = SwiftypeAppSearch.createClient({
  hostIdentifier: '[HOST_IDENTIFIER]',
  apiKey: '[SEARCH_KEY]',
  engineName: '[ENGINE_NAME]'
})

You can now access the App Search API from within your JavaScript application code.

Check out the GitHub repository for further information on available methods and building.

Python

GitHub repository

Swiftype offers an official Python client for interacting with the Swiftype App Search API. The client depends on requests and PyJWT. It supports Python 2.7 and Python 3.3+.

You will need to have an active Swiftype account with at least one available engine. No account? Sign up here.
Installation

To install the Python client, you will need pip...

$ python -m pip install swiftype_app_search

Alternatively, you can clone the project then run the setup.py script to complete the installation:

$ git clone git@github.com:swiftype/swiftype-app-search-python.git && cd swiftype-app-search-python
$ python setup.py install
Configuration

To make use of the client, you must instantiate it. In order to do this, you will need two items from the API Keys menu. You can find that menu within your App Search dashboard under Access.

First, you will need to retrieve your [HOST_IDENTIFIER]. This key represents the unique hostname that belongs to your Swiftype account.

The second thing you will need is your [API_KEY]. This key is needed for authentication.

>>> from swiftype_app_search import Client
>>> host_identifier = '[HOST_IDENTIFIER]'
>>> api_key = '[API_KEY]'
>>> client = Client(host_identifier, api_key)

You can now access the App Search API from within your Python application code.

Check out the GitHub repository for further information on how to make use of the client.

Node.js

GitHub repository

The App Search API has an official Node.js client. The package is hosted within npmjs.com.

You will need to have an active Swiftype account with at least one available engine. No account? Sign up here.
Installation

Install the package using the Node Package Manager.

$ npm install swiftype-app-search-node
Configuration

Configuring the package requires two items from the API Keys menu. You can find that menu within your App Search dashboard under Access.

First, you will need to retrieve your [HOST_IDENTIFIER]. This key represents the unique hostname that belongs to your Swiftype account.

The second thing you will need is your [API_KEY]. This key is needed for authentication.

Plug them into your code:

const SwiftypeAppSearchClient = require('swiftype-app-search-node')
const hostIdentifier = 'host-c5s2mj'
const apiKey = 'private-mu75psc5egt9ppzuycnc2mc3'
const client = new SwiftypeAppSearchClient(hostIdentifier, apiKey)

You can now access the App Search API from within your Nodejs application code.

Check out the GitHub repository for further information on available methods and testing.


Stuck? Looking for help? Contact Support!