Developer Hub

Welcome to the EVRYTHNG Developer Hub! Here you will find all the information you need to create your EVRYTHNG apps and integrations. We have conceptual guides, walkthroughs, and tutorials as well as a complete API reference.

Featured Pages

scanthng.js

The scanthng.js SDK is a plugin to be used in combination with evrythng.js to allow easy access to the Identifier Recognition API. This allows JavaScript applications to use local images or image capture devices to lookup Platform resources when presented with a barcode or pre-specified image.

To learn more about implementing identification of codes associated with Platform Thngs and products, read Real-time Web Product Scanning.


Installation

Installation is similar to the evrythng.js SDK, but the library name is scanthng.js instead of evrythng. Note that installation of evrythng.js or evrythng-extended.js is required to use this plugin.

Including the library in an application and performing initialization is identical. However, because this is a plugin, make sure to apply it to the base SDK:

EVT.use(Scan);

Function Reference

All the functions available below should be used with an instance of an Application scope.

See the Identifier Recognition page for full details on params specified below, which are used to determine the type of scan performed.

.scan(params);  // Initiate image capture with params containing the filter

.scan(base64Data, params);  // Scan a pre-shot image converted to a Base64 string
app.scan({
  filter: { method: '2d', type: 'qr_code' },
}).then(console.log);
.scanStream(params);  // Scan a barcode using a video stream from a device camera.
// Fast 2D QR code scanning
app.scanStream({
  filter: { method: '2d', type: 'qr_code' },
  
  // HTML element the video stream will be displayed within
  containerId: 'stream_container',
}).then(console.log);

// Slower other barcode scanning, but still using video
app.scanStream({
  filter: { method: '2d', type: 'dm' },
  containerId: 'stream_container',
}).then(console.log);
.identify(params);  // Read Thng/product linked to a predetermined Platform identifier value
app.identify({
  filter: { value: 'https://tn.gg/C1SNa4dtKF', type: 'qr_code' }
}).then(console.log);
.redirect(url);  // Redirect the browser to a URL, usually provided by an identification.
app.scan({
  filter: { method: '2d', type: 'qr_code' }
}).then((res) => {
  // Redirect to the specified URL
  app.redirect(res[0].results[0].redirections[0]);
});

Additional Options

There are a set of additional options available to enhance the functionality of the scan. These should be included in the params alongside filter.

  • createAnonymousUser - Set to true to create an anonymous Application User to perform the scan.
  • perPage - Set to the desired maximum number of results per page.
  • imageConversion - Specify some conversion that should take place before the scan is performed.