In one of my last blog posts I wrote about Creating QR code for wireless networks. I think it would be cool to have QR codes on my devices and link those to my Asset management system. My Asset management system is Snipe-IT and it addresses devices or hardware by an ID in the URL as shown in the screenshot.
The challenge is now how to “transform” the Asset tag on a device into an ID,
which can be called in Snipe-IT’s URL. The API of Snipe-IT helps. At
is the API reference how to get device information by an Asset tag.
Python script to look up ID in Snipe-IT by Asset tag
With this knowledge, I’m writing a small Python script which takes the Asset tag as URL parameter, looks it up via API call in Snipe-IT and then parse out the ID from the JSON result. If Snipe-IT finds a device ID, the script is then forwarding the request to the correct URL with the hardware ID. If there is no result, then the script just forwards to the default page.
Generating QR code with Asset tag URL
The QR code must contain the URL of the script with the Asset tag as parameter.
To create the QR code, the following command line can be used:
The QR code with the Asset tag looks like in the example shown below and can be
printed out to a label.