These docs are for v1.0. Click to read the latest docs for v2.0.


# Getting Started

Taplytics decisions is an API to quickly use Taplytics features and functionality at edge.

## Initialization

First, import the taplytics-java-sdk JAR into your project.

Then, import the API client into the desired class:

ο»Ώ

API client can be then initialized as following:

ο»Ώ

## Identification

All method calls to Taplytics require a user id. This is to ensure that the user will always receive the correct experiments and variations across all platforms.

## Methods

All methods can be handled with a callback, or used as a CompletableFuture, i.e.

ο»Ώ

If a callback is provided, the function will not return a promise.

### getBucketing

Returns a key/value pairing of all experiments that the user has been segmented into, as well as the variation the users are assigned.

#### Parameters

ParameterTagsDescription
userId`Required`ID for current user
attributes`Optional`Provide all relevant attributes associated with the user
callback`Optional`Provide a callback if you don't want to use a promise

#### Example Usage

ο»Ώ

### getVariables

All variables and their values for the given user

#### Parameters

ParameterTagsDescription
userId`Required`ID for given user
attributes`Optional`All relevant attributes associated with the user
callback`Optional`Provide a callback if you don't want to use a promise

#### Example Usage

ο»Ώ

### getVariationForExperiment

For a given experiment, determine whether or not a user is in the experiment, and in which variation

#### Parameters

ParameterTagsDescription
userId`Required`ID for given user
experimentName`Required`Name of an Experiment
attributes`Optional`All relevant attributes associated with the user
callback`Optional`Provide a callback if you don't want to use a promise

#### Example Usage

ο»Ώ

### getVariableValue

Value for given Taplytics Dynamic Variable. If a user is not in an experiment containing the variable, the response be the provided default value in the query params.

#### Parameters

ParameterTagsDescription
userId`Required`ID for given user
varName`Required`name of variable
defaultValue`Required`default value to be used if user does not have variable available.
attributes`Optional`All relevant attributes associated with the user
callback`Optional`Provide a callback if you don't want to use a promise

#### Example Usage

ο»Ώ

### sendEvent

Send an event to Taplytics. These events are then used to compare against an experiment's goals to determine the success of an A/B test.

#### Parameters

ParameterTagsDescription
userId`Required`ID for given user
body`Optional`Provide an array of events, as well as all additional relevant user attributes.
callback`Optional`Provide a callback if you don't want to use a promise

#### Example Usage

ο»Ώ

### getConfig

Returns the entire configuration for the project. This is the document that informs the experiment information such as segmentation. Extremely verbose and should be used for debugging.

#### Parameters

ParameterTagsDescription
userId`Required`ID for given user
attributes`Optional`All relevant attributes associated with the user
callback`Optional`Provide a callback if you don't want to use a promise

#### Example Usage

ο»Ώ

### getFeatureFlags

Returns array of all the enabled feature flags for this project. Each object in the array has `name` for the name of the feature flag and `keyName` for the feature flag's key to be used in your code

#### Parameters

ParameterTagsDescription
userId`Required`ID for given user
attributes`Optional`All relevant attributes associated with the user
callback`Optional`Provide a callback if you don't want to use a promise

#### Example Usage

ο»Ώ

### isFeatureFlagEnabled

Returns true or false depending if the `keyName` provided corresponds to an enabled featureFlag in your Taplytics project

#### Parameters

ParameterTagsDescription
userId`Required`ID for given user
keyName`Required`Key name for the feature flag
attributes`Optional`All relevant attributes associated with the user
callback`Optional`Provide a callback if you don't want to use a promise

#### Example Usage

ο»Ώ

ο»Ώ