HID over REST API

Introduction

All AdvanReader-160/70 based devices sport an USB HID port to act as a keyboard on a host computer and send keyboard strokes. This is already used on the AdvanPay series of devices to replace a barcode reader. This document explains how to send the text you want over the REST API

How to

There are two REST endpoints that allow sending keystrokes over the USB HID to a host computer:

http://device_ip/device/sendHID/:content

and

http://device_ip/device/sendHIDNL/:content

the second endpoint concatenates a \r and a \n at the end of the provided content

e.g.: curl --digest -u admin:admin http://device_ip/device/sendHID/HelloWorld

Note: this will return an error if the HID cable is not connected:

<?xml version="1.0" encoding="UTF-8"?>
<response>
<type>response</type>
<ts>1689251361888</ts>
<status>ERROR</status>
<op>sendHID/HelloWorld</op>
<msg>INTERNAL_ERROR: Could not send the keystrokes, check that the cable is connected</msg>
</response>