Bot Manager Premier SDK

Integrating with iOS Apps

This section describes the overall process used for iOS apps. Get Started in three main steps:

  1. Install the Bot Manager Premier SDK.
  2. Start collecting sensor data.
  3. Configure your response codes from the edge. 

Installation

Summary: 

Size: The SDK framework is 9.4 MB. After installing the SDK, the app binary size will be increased approximately by 300 KB.

Architectures: armvy, arm64, i386 & x86_64

Note: Architectures i386 and x86_64 are only used in the simulator and are not included in the final AppStore app. 

 

Requirements:

  • Bot Manager Customer

  • Xcode 8 and above

  • iOS 8.0 and above

 

Install the SDK:

  1. Download the SDK

  2. Drag the AkamaiBMP.framework and drop it into your XCode Project.

  3. In the Choose Options dialog box, select Copy items if needed.

 

 

Edit the Build Settings:

Under Build Settings, navigate to Linking and then under Other Linker Flags add -ObjC.

Note: the SDK is initialized automatically for iOS, and so, unlike Android, no explicit initialization step is required here.

 

Collect Sensor Data:

Now you can collect sensor data. Note that the device information doesn't contain any information that will identify this device uniquely.

  1. Import the SDK header into your source file:
    [prism:generic}// Import the SDK header #import
    #import <Akamai/CYFMonitor.h>[/prism:generic]

  2. Bot Manager's sensor data contains serialized behavioral data and device information. To retrieve the sensor data from the SDK call the CYFMonitor getSensorData method. Sensor data should be sent in the REST API request as detailed below.

    // Get the BMP sensor data
    NSString * sensorData = [CYFMonitor getSensorData];

Important: Call the getSensorData method only on REST API requests to URLs that will be configured for protection in Bot Manager Premier Mobile. Do not call the getSensorData method for non-protected URLs.

Send Sensor Data:

After the sensor data is retrieved from the SDK, it should be sent in X-acf-sensor-data HTTP header as part your applications REST API (HTTP/S) request. We recommend using HTTPS for the REST API request to ensure the integrity of sensor data and prevent eavesdropping. Send the X-acf-sensor-data header only on HTTP requests to URLs configured for protection in Bot Manager Premier Mobile. Do not send the header and sensor data on every HTTP request the app makes.

// set the sensor-data header
[request addValue:sensorData forHTTPHeaderField:@"X-acf-sensor-data"];

 

Evaluate the Akamai Edge Response:

Akamai edge server inspects sensor data and takes the predefined action on the request if the request is classified as BOT, otherwise Akamai sends the request to the origin server.

See Akamai Edge Response below for more details.

 

Sample Code – Getting and Sending Sensor Data

The following code snippet shows how to get the sensor data and send it in the HTTP request.

// Import the SDK header
#import

//....
//....

// Example login button action
- (IBAction )loginAction: (id )sender {

     // Get the BMP sensor data
     NSString * sensorData = [CYFMonitor getSensorData];

     // Create the request.
     NSMutableURLRequest * request = [NSMutableURLRequest
          requestWithURL:[NSURL
URLWithString:@"https://bmpapi.akamai.com/samples/v1/login"]];

     // set the sensor-data header
      [request addValue:sensorData forHTTPHeaderField:@"X-acf-sensor-data"];

     // send the request object using NSURLConnection or NSURLSession
}

 

iOS API

Class

CYFMonitor (added in Version 2.0.0)

CYFMonitor provide methods to access the BMP SDK. All methods in this class are class methods and can be accessed from anywhere without creating an instance and methods can be invoked from any thread.

See the individual method details for more information.

 

Public Methods

getSensorData

+ (NSString * )getSensorData ;

Get the serialized user behavior data, device events and device information to be sent with the REST api that needs to be protected.

 

Returns:

NSString Serialized sensor data

setLogLevel

+ (void )setLogLevel: (CYFLogLevel) logLevel;

Set the log level for the Akamai BMP SDK. See CYFLogLevel for a list of valid values.

 

Parameters:

logLevel CYFLogLevel: A valid log level value

Enumeration

 

CYFLogLevel (added in Version 2.0.0)

The log level to control the logging in the SDK. The values are used with CYFMonitor setLogLevel method.

Constants

CYFLogLevelInfo

Constant to log all messages from the SDK

CYFLogLevelWarn

Constant to log all warning and error messages from the SDK

CYFLogLevelError

Constant to log only error messages from the SDK

CYFLogLevelNone

Constant to log no messages from the SDK

 

Logging

Akamai BMP SDK logs some messages at all log levels to verify the SDK initialization. These messages are helpful in identifying any integration issue and ensure the SDK is initialized successfully. In addition to these messages, the SDK logs additional messages at info, warn and error levels, to verify and debug that the SDK is working correctly. The default log level for the SDK is to log warning and error messages only. This behavior can be changed by calling setLogLevel API.

To set the log level, call CYFMonitor setLogLevel API with one of the log level specified below:

// Set the log level to Info
[CYFMonitor setLogLevel:CYFLogLevelInfo];

These are the available logging levels:

  • CYFLogLevelInfo - Print all messages.

  • CYFLogLevelWarn - (Default) Print warning and error messages only.

  • CYFLogLevelError - Print error messages only.

  • CYFLogLevelNone - Turn off all log messages from the SDK.