Retrieving Scans


A scan object is created every time an Openscreen dynamic QR Code is scanned. We will be retrieving Scan data for a Dynamic QR code.

Requirements

Capturing Scans

To begin, you must first scan an Openscreen Dynamic QR Code. Use the code below to get all scans captured against an Asset:

1 2 3 4 5 // Obtain assetId from previous response const { assetId } = response.asset; // Get all scan data for a specific assetId const assetScans = await os.asset(assetId).scans().get();
1 2 3 4 5 #// Obtain asset_id from previous response asset_id = response.asset.asset_id #Get all scan data for a specific assetId asset_scans = os.asset(asset_id).scans().get();

The response contains a list of Scan objects which contain valuable information. Here's an example of a Scan object:

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 { "entityType": "app.scan", "created": "2021-10-07T18:38:06.616Z", "modified": "2021-10-07T18:38:06.616Z", "assetId": "0a43a07c-0e57-4879-9420-332a13174458", "scanId": "f3333e42-e864-44f1-b5c0-bde9c31952d7", "projectId": "c166f2dd-9ea8-4a79-90d5-fa6989f885e6", "qrCodeId": "2a1ffa66-9a3f-4ea3-ab40-35a93f392d57", "ipAddress": "xx.xxx.xxx.xx", "scanTime": "2021-10-07T18:38:05.557Z", "userAgent": "Mozilla/5.0 (iPhone; CPU iPhone OS 14_7_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/14.1.2 Mobile/15E148 Safari/604.1", "deviceType": "mobile", "deviceModel": "iPhone", "deviceVendor": "Apple", "osName": "iOS", "osVersion": "14.7.1", "engineName": "WebKit", "engineVersion": "605.1.15", "browserName": "Mobile Safari", "browserVersion": "14.1.2", "locationPostalCode": "M6H", "locationLatitude": "43.66530", "locationLongitude": "-79.43430", "locationCityName": "Toronto", "locationRegionName": "Ontario", "locationRegionCode": "ON", "locationCountryName": "Canada", "locationCountryCode": "CA", "locationTimeZone": "America/Toronto", "locationString": "Toronto, Ontario, Canada" }
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 { "entity_type": "app.scan", "created": "2021-10-07T18:38:06.616Z", "modified": "2021-10-07T18:38:06.616Z", "asset_id": "0a43a07c-0e57-4879-9420-332a13174458", "scan_id": "f3333e42-e864-44f1-b5c0-bde9c31952d7", "project_id": "c166f2dd-9ea8-4a79-90d5-fa6989f885e6", "qrCode_id": "2a1ffa66-9a3f-4ea3-ab40-35a93f392d57", "ip_address": "xx.xxx.xxx.xx", "scan_time": "2021-10-07T18:38:05.557Z", "user_agent": "Mozilla/5.0 (iPhone; CPU iPhone OS 14_7_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/14.1.2 Mobile/15E148 Safari/604.1", "device_type": "mobile", "device_model": "iPhone", "device_vendor": "Apple", "os_name": "iOS", "os_version": "14.7.1", "engine_name": "WebKit", "engine_version": "605.1.15", "browser_name": "Mobile Safari", "browser_version": "14.1.2", "location_postal_code": "M6H", "location_latitude": "43.66530", "location_longitude": "-79.43430", "location_city_name": "Toronto", "location_region_name": "Ontario", "location_region_code": "ON", "location_country_name": "Canada", "location_country_code": "CA", "location_time_zone": "America/Toronto", "location_string": "Toronto, Ontario, Canada" }

The unique identifier scanId is extremely valuable in creating workflows with Dynamic QR codes. You will be using this scanId to programatically create contacts and send SMS.

Next Steps