Barcode lookup sources

The Barcode Scanner keeps decoding local. In Lookup, pressing Look up sends the displayed identifier to the selected source. Open Food Facts requests pass through Parks Computing so the server can identify the app and enforce the provider's request limit. Custom HTTPS sources receive requests directly from your browser and must permit cross-origin access.

Customize a source

  1. Choose Actions, then Lookup sources.
  2. Select a default and press Copy as new source.
  3. Edit its JSON definition and press Save source. Keep the generated ID.
  4. Return to Lookup and select the copy.

Sources stay in this browser. Export downloads an importable JSON file. An exported default receives a user ID so it can be customized. Import validates the complete file and rejects duplicate IDs without changing existing sources. Editing or deleting a copy never changes a bundled default. To replace an existing source, use Edit.

Identifier eligibility

Product sources receive complete, checksum-validated EAN-13, EAN-8, UPC-A or UPC-E identifiers. UPC-E expands to UPC-A before lookup, while the raw capture stays unchanged. Restricted-circulation codes require retailer layouts in Decode. For typed digits, choose the input format in Type or paste. The scanner does not infer a product identifier from arbitrary QR text.

Open Food Facts covers food products. A missing record does not make the barcode invalid. Its default excludes book, periodical and coupon ranges. URL preview accepts complete HTTP(S) addresses without embedded credentials, displays the destination, and opens it only when you press Open URL.

Version 1 source definitions

Every definition has an ID beginning with user:, a name, a description, accepted identifier kinds and an execution kind. This release supports gtin and uri. Optional symbology restrictions use ean13, ean8, upca, upce or the other canonical scanner keys shown in the design documentation. An omitted restriction accepts any format carrying an established identifier.

A request source uses json-get with a fixed HTTPS origin, or the fixed open-food-facts connector. URL preview uses execution: local and handler: http-url-v1. Other local handlers, POST, credentials, custom headers and scripts are not supported in this release. Unsupported properties are rejected.

The path may contain {identifier.value}. Query bindings support identifier.value, identifier.kind, symbology.endpoint, or an object containing a literal string. A required symbology mapping must exist before the request can run. One endpoint can accept multiple symbologies with different mappings, or omit the map if it needs no symbology parameter.

{
  "format": "pc-barcode-lookup-sources",
  "version": 1,
  "sources": [{
    "id": "user:catalogue",
    "name": "My catalogue",
    "description": "Look up a product in my catalogue",
    "execution": "request",
    "accepts": [{ "kind": "gtin", "symbologies": ["ean13", "upca"] }],
    "symbologyMap": { "ean13": "EAN_13", "upca": "UPC_A" },
    "request": {
      "transport": "json-get",
      "origin": "https://catalogue.example",
      "path": "/products/{identifier.value}",
      "query": { "format": "symbology.endpoint" }
    },
    "response": {
      "adapter": "json-fields-v1",
      "found": { "pointer": "/found", "equals": true },
      "notFound": { "pointer": "/found", "equals": false },
      "title": "/product/name",
      "fields": [{ "label": "Brand", "pointer": "/product/brand" }]
    },
    "attribution": {
      "name": "My catalogue",
      "url": "https://catalogue.example",
      "text": "Data from my catalogue."
    }
  }]
}

The example domain is illustrative. Replace it with a documented endpoint that returns JSON such as {"found":true,"product":{"name":"Tea","brand":"Example"}}. For a missing item, return {"found":false}. A generic HTTP 404 reports an endpoint error; the provider-specific Open Food Facts connector handles that provider's documented missing-product response separately.

The response adapter reads JSON Pointers. Exactly one found/not-found predicate must match with the same JSON type. Found products need a nonempty title. Optional missing fields are omitted; displayed fields must be strings, numbers or booleans. Responses are limited to 2 MiB and requests time out after 15 seconds. Redirects are rejected, so configure the final endpoint. Requests omit cookies and referrers.

Food data attribution

Food data comes from Open Food Facts contributors. The database is available under the Open Database License, and individual contents under the Database Contents License. Product information may be incomplete or inaccurate. The scanner does not download product images.

Read the comments on this article