Using the Scan Correlation Features and Correlation ID

This Article will explain what the correlationId parameter is and how it can be used across all our Platforms with any of our Anyline scanning capabilities.

 


What is the Correlation ID?

The Correlation ID is a unique key in the UUIDv4 format that customers can optionally pass as an additional parameter. This ID can be assigned to a scan and all subsequent scans of a workflow or business process, whether from a single Anyline scanning capability or a series of scans from various Anyline scanning capabilities.

IMPORTANT:

The Correlation ID must be in the UUIDv4 format, otherwise an error will be thrown in the respective call or request.

Please see an example of the UUID format structure below.

 

UUID Example 1-20241014-094012.png

 


What can I use the Correlation ID for?

By utilizing the Correlation ID during your scans, you can get a more streamlined way of identifying and organizing scans specific to your use and/or workflow. Additionally, it allows you to unlock advanced analytics and insights, providing more granular scan tracking and delivering cross-module intelligence to better understand your scan data.

Examples of Correlation ID Usage

PLEASE NOTE:

The Correlation ID value is not provided by Anyline, but provided by the Integrator. There are various frameworks and ways to safely generate a UUIDv4. Some examples are provided in some of the code snippets below.

  1. Tire Tread Measurements:

    • If a Customer wishes to measure the tire tread of a car, each of the four measurements can be assigned the same Correlation ID. This ensures that all data related to that specific car’s tire tread is grouped together for easy reference and analysis.

  2. Comprehensive Vehicle Inspection:

    • If a Customer wishes to identify a car by using the License Plate scanning capabilities, checking the four tires using the Tire Sidewall Scanner, and then measuring the tread of all four tires, all nine transactions can be assigned the same Correlation ID. This way, all related scans are linked, providing a complete overview of the vehicle’s inspection process.

Using the Correlation ID in these ways helps streamline data management and enhances the ability to track and analyze related scans efficiently.

PLEASE NOTE:

The Correlation ID parameter is not limited to our automotive-related scanning capabilities. It can be used to combine any of our scanning capabilities into a single, grouped collection of data.

 


How can I use the Correlation ID?

Here is how you can use the Correlation ID using the following Anyline Products and Platforms:

Mobile SDK

For the Anyline Android Native SDK, you can now pass an optional parameter InitializationParameters to methods initializing ScanView as well as in ScanViewConfigHolder.

This object lets you set a correlationId value which would be used in subsequent scans.

For example:

Java:

ScanViewInitializationParameters initParams = new ScanViewInitializationParameters(); initParams.setCorrelationId(UUID.randomUUID().toString()); scanView.init("barcode_config.json", initParams);

Kotlin:

val initParams = ScanViewInitializationParameters() initParams.correlationId = UUID.randomUUID().toString() scanView.init("barcode_config.json", initParams)

For the Anyline iOS Native SDK, you can now pass an optional parameter InitializationParameters to methods initializing ALScanView as well as in ALScanViewFactory.

This object lets you set a correlationId value which would be used in subsequent scans.

For example:

Swift:

let initParams = ALScanViewInitializationParameters.init() let correlationId = UUID().uuidString initParams.correlationID = correlationId let scanView = try ALScanView(frame: .zero, scanViewConfig: scanViewConfig, initializationParams: initParams)

Objective-C:

ALScanViewInitializationParameters *initParams = [[ALScanViewInitializationParameters alloc] init]; NSString *correlationId = [NSUUID UUID].UUIDString; initParams.correlationID = correlationId; NSError *error; ALScanView *scanView = [[ALScanView alloc] initWithFrame:CGRectZero scanViewConfig:scanViewConfig initializationParams:initParams error:&error];

For the Anyline Cordova Plugin, you can now pass an optional parameter Dictionary? initializationParams to the scan method.

This object lets you set a correlationId value which would be used in subsequent scans.

For example:

initializationParams = { "correlationId": "0d4e794b-272f-45f4-b8ca-07dd84975a7d" } cordova.exec(this.onResult, this.onError, "AnylineSDK", "scan", [config, initializationParams]);

For the Anyline Flutter Plugin, you can now pass an optional parameter String? initializationParams to the startScanning() method.

This object lets you set a correlationId value which would be used in subsequent scans.

For example:

startScanning(configJson, "{'correlationId': '0d4e794b-272f-45f4-b8ca-07dd84975a7d'}")

For the Anyline .NET Plugin, you can now pass an optional initializationParameters parameter to the ScanView.init() (Android) or ALScanViewFactory.WithConfigFilePath (iOS) methods.

This object lets you set a correlationId value which would be used in subsequent scans.

For example:

Android:

ScanViewInitializationParameters initParams = new ScanViewInitializationParameters(); initParams.CorrelationId = Guid.NewGuid().ToString(); _scanView.Init(jsonConfigFilePath, initParams);

iOS:

ALScanViewInitializationParameters initParams = new ALScanViewInitializationParameters(); initParams.CorrelationID = Guid.NewGuid().ToString(); _scanView = ALScanViewFactory.WithConfigFilePath(configPath, initParams, _resultDelegate, out error);

For the Anyline React Native Plugin, you can now use a new method called setupPromiseWithInitializationParameters in place of setupPromise in order to pass in additional initialization parameters, including a correlationId value, which can be used to associate related scanning sessions.

For example:

const result = await AnylineOCR.setupPromiseWithInitializationParameters( "{\"correlationId\": \"0d4e794b-272f-45f4-b8ca-07dd84975a7d\"}", JSON.stringify(config), 'scan' );

Tire Tread SDK

For the Anyline Tire Tread SDK, you can now connect the correlationId to the additionalContext property, allowing you to amalgamate other Anyline Scan Processes to the tread depth measurements from the Tire Tread SDK.

PLEASE NOTE:

The AdditionalContext is an optional property which allows you to provide more context to a scan. This makes sense in a workflow, where a scan is connected to other Tire Tread scans or other information in a larger context. For more information about AdditionalContext and what it requires, please visit our Tire Tread SDK Documentation Page.

To connect your scans with one of our other Anyline capabilities you can pass a correlationId with the additionalContext either via a JSON configuration file or in the code itself. Please see the following examples below:

{ "useDefaultUi": true, "useDefaultHaptic": true, "defaultUiConfig": { "distanceIndicatorConfig": { "visible": true, "textOk": "Mantenha a distância.", "textMoveCloser": "Chegue mais perto.", "textMoveAway": "Aumente a distância." }, "focusPointTooltipConfig": { "visible": true, "text": "Mova o dispositivo para frente e para trás para detectar o pneu." }, "howToScanTooltipConfig": { "visible": true, "text": "Alinhe o pneu com o overlay." }, "tapToStartScanningTooltipConfig": { "visible": true, "text": "Toque na tela para iniciar o processo." }, "tireOverlayConfig": { "visible": true }, "uploadViewConfig": { "visible": true, "text": "Enviando imagens, aguarde." }, "progressTimerConfig": { "visible": true }, "lineProgressBarConfig": { "visible": true }, "orientationWarningConfig": { "visible": true, "text": "Please rotate the phone to landscape mode" } }, "scanSpeed": "Fast", "measurementSystem": "Metric", "additionalContext": { "tirePosition": { "axle": 1, "side": "Left", "positionOnAxle": 1 }, "correlationId": "00000000-0000-0000-0000-000000000000" } }
@Composable fun TireTreadScanViewWithTireTreadScanViewConfig() { // Define the values for your config val tireTreadScanViewConfig = TireTreadScanViewConfig().apply { additionalContext = AdditionalContext().apply { correlationId = "00000000-0000-0000-0000-000000000000" } } // Invoke the TireTreadScanView composable with the TireTreadScanViewConfig above TireTreadScanView(context = this, config = tireTreadScanViewConfig, callback = object : TireTreadScanViewCallback { // override callbacks for events needed during your scans }) { // handle initialisation error } }
private func setupTireTreadScanView() { let config = TireTreadScanViewConfig() let additionalContext = AdditionalContext() // set correlation ID additionalContext.correlationId = "00000000-0000-0000-0000-000000000000" config.additionalContext = additionalContext TireTreadScanViewKt.TireTreadScanView(context: UIViewController(), config: config, callback: self) { [weak self] error in // handle initialisation error } self.dismissViewController = { [weak self] in self?.navigationController?.popViewController(animated: true) } addScanViewControllerAsChild() }

Web SDK

For the Anyline Web SDK, you can now add a parameter correlationId to the AnylineJSParams interface. This parameter lets you set a correlationId value which can be used to correlate scan data across multiple scans and platforms (See https://js.anyline.com/release/54.1.0/docs/interfaces/types.AnylineJSParams.html#correlationId ).

PLEASE NOTE:

AnylineJSParams refers to the interface that contains the list of available configuration parameters for the Web SDK.

For example:

const Anyline = window.anylinejs.init({ license: license, element: root, correlationId: '00000000-0000-0000-0000-000000000000' });

Cloud API

For the Anyline Cloud API, you can now provide the correlationId as part of the request. This parameter will be sent with the request to correlate scan data across multiple scans and platforms.

For Cloud API v1, add the correlationId the same way you would add the config, license and blob parameters to your request:

POST /v1/scan Host: api.anyline.com Accept: application/json { "config": { ... }, "license": "MyAnylineAPILicense", "blob": "Base64EncryptedString", "correlationId": "00000000-0000-0000-0000-000000000000" }

For Cloud API v2, just add the correlationId next to the image data (in this example, a tiresidewall request):

curl --request POST \ --url https://api.anyline.com/v2/tiresidewall \ --header 'Authorization: Bearer YOUR_ACCESS_TOKEN' \ --data '{image: "yourBase64Image", correlationId: "00000000-0000-0000-0000-000000000000"}'

Tire Tread Instant App

For the Tire Tread Instant App, you can now provide the correlationId to the Instant App Integration SDK. This parameter will be handed to the Instant App to correlate scan data across multiple scans and platforms. When starting the scan from the Instant App Integration SDK just pass it the correlationId:

For example:

tireSDK.startScanning({ "exitURL": "https://example.com/result", "errorURL": "https://example.com/error", tokenData: session, workflowVersion: TireTreadSDK.WorkflowType.MultiScan, measurementUnit: TireTreadSDK.MeasurementUnits.Metric, scanSpeed: TireTreadSDK.ScanSpeed.Fast, tireWidth: [205, 225], showTutorial: true, showScanResultsInApp: true, correlationId: "123456" // pass a unique ID }) .then(() => { console.log("Scanning started"); }) .catch(error => { console.log("Error starting scanning: ", error); displayError(error.message); });