# HTTP

The HTTP Output Component allows you to perform HTTP requests and fetch data from external end-points.

The request is performed from the computer once a scan is received from the smartphone.

Example use cases are:

  • Perform barcode lookups using third-party services
  • Obtain other information when a barcode is scanned
  • Communicate with e-commerce platforms such as WooCommerce, Shopify, etc. to change the stock quantity, update orders, etc.

# Parameters

Parameter name Description
Skip Output If enabled, the HTTP output won't affect the Keyboard Emulation and the CSV output.
URL The URL to use for the request. You can use the values acquired by the other components by accessing the corresponding variables using the double-curly braces syntax. Available variables (lowercase):
  • barcode
  • barcodes
  • number
  • text
  • timestamp
  • date_time
  • scan_session_name
  • device_name
  • select_option
  • http
  • run
  • csv_lookup
  • csv_update
  • javascript_function
Example: "https://www.example.com/?item={{ barcode }}"
Method Is the request method to be used when making the request. Consult your software/service documentation and set it accordingly.
Data Is the data to be sent as the request body. Only applicable for request methods PUT, POST, DELETE, and PATCH.
Params Are the URL parameters to be sent with the request. You can either pass them here or in the URL. It must be a valid JSON string. Example: { "product": "", "quantity": }
Headers Are custom headers to be sent. It must be a valid JSON string. Example: { "Content-Type": "application/json" }
Timeout Specifies the number of milliseconds before the request times out. If the request takes longer than the specified time, the request will be aborted.

# Output

The response body will be used as output for the Keyboard Emulation feature, and for the Append to CSV file option.

The output value will be also stored into the http variable, and can be used inside other components, such as JAVASCRIPT_FUNCTION.

# Example

Let’s say that you want to scan a product and put the brand name next to the barcode column, like this:

To do that we’re going to use the free Gtinsearch API Free Lookup service.

The final output template will look like this:

  • It contains a BARCODE component to instruct the app to acquire a barcode and store the value inside the barcode variable
  • The TAB component is used to move the cursor to the next cell
  • The HTTP component will fetch the data using the following URL: https://www.gtinsearch.org/api/items/.
  • The JAVASCRIPT_FUNCTION component, will extract the data from the JSON fields using this code: JSON.parse(http)[0].brand_name

  • The ENTER component is used to move the cursor to the new line


To reproduce this example:

  1. Download the attached Lookup.btpt template
  2. Double click on it to import to the server settings
  3. Open the app and select the red scan button
  4. Select the “Lookup” Output template

Downloads: