Migrating SDK from v1 to v2
  • 09 Nov 2023
  • Dark
    Light

Migrating SDK from v1 to v2

  • Dark
    Light

Article Summary

Start the SDK

In version 1.x, the start function is called with two parameters: AppId and enableDoctorCheck (the later was added in 1.16.0).

In version 2.0, the start function has additional parameters:

  1. delegate (PerimeterXDelegate) to handle the SDK's events.
  2. completion handler to handle the result of the start process.

Notice that the new Interceptor will be enabled in 2.0. This has effect on the integration with the SDK, which is described in this document.

Set custom parameters

In version 1.x, the set custom parameters function is called with the dictionary parameter only.

In version 2.0, the setCustomParameters function has another optional param: the AppID. This is required only when using multiple AppIDs.

Get VID

In version 1.x, the get VID function is called without any parameters.

In version 2.0, the vid function has another optional param: the AppID. This is required only when using multiple AppIDs.

Get HTTP headers

In version 1.x, the get HTTP headers function is called without any parameters.

In version 2.0, the headersForURLRequest function has another optional param: the AppID. This is required only when using multiple AppIDs.

Check error and handle response

In version 1.x, a function is called to get the HUMAN's error response from the request's response which called another function to handle the HUMAN's error response.

In version 2.0 the flow is as following:

  1. If the interceptor is enabled, simply check whether the request was blocked with the isRequestBlockedError function
  2. If the interceptor is disabled, use the HUMAN SDK to handle the response with the handleResponse function. If it was a blocked response, the SDK will handle it and the function will return true

Other functions

All other functions existing in version 1.x were removed from the SDK's API in version 2.0.


Was this article helpful?