This add-on is operated by Expedited Security
Generate QR codes for use anywhere
QRackajack
Last updated December 06, 2023
The QRackajack add-on is currently in beta.
Table of Contents
Qrackajack is an add-on to generate QR codes for use anywhere.
QR codes offer a means of connecting the real world to the virtual. Embed URLs, phone numbers or addresses within them and QR code readers will launch the associated applications when scanned.
Our custom styling options let you integrate your QR code designs into almost any site or company color scheme.
Qrackajack exposes an API and has supported examples for Ruby, PHP, Python, Node and Java.
Provisioning the add-on
Qrackajack can be attached to a Heroku application via the CLI:
A list of all plans available can be found here.
$ heroku addons:create qrackajack
-----> Adding qrackajack to sharp-mountain-4005... done, v18 (free)
Once Qrackajack has been added a QRACKAJACK_API_KEY
config variable will contain your specific API key granting access to the newly provisioned Qrackajack instance. This can be confirmed using the heroku config:get
command.
$ heroku config:get QRACKAJACK_API_KEY
Bl4XHVbdsf5GIXQbqTfXR5IrpuuXER2kaVc2zNnA
After installing Qrackajack your application should be modified to fully integrate with the add-on.
Local setup
Environment setup
After provisioning the add-on it’s necessary to locally replicate the config vars so your development environment can operate against the service.
Use the Heroku Local command-line tool to configure, run and manage process types specified in your app’s Procfile. Heroku Local reads configuration variables from a .env
file. To view all of your app’s config vars, type heroku config
. Use the following command for each value that you want to add to your .env
file.
$ heroku config:get QRACKAJACK_API_KEY -s >> .env
Credentials and other sensitive configuration values should not be committed to source-control. In Git exclude the .env
file with: echo .env >> .gitignore
.
For more information, see the Heroku Local article.
Input Parameter Descriptions
All languages will follow this call structure for inputs.
Index | Name | Example | Description |
---|---|---|---|
0 | content |
string | The content to encode into the QR code (e.g. a URL or a phone number) |
1 | width |
integer | The width of the QR code (in px) |
2 | height |
integer | The height of the QR code (in px) |
3 | fg_color |
string | The QR code foreground color (you should always use a dark color for this) |
4 | bg_color |
string | The QR code background color (you should always use a light color for this) |
Using with Ruby
Install the Qrackajack gem.
# In your Gemfile
gem 'qrackajack', git: 'https://github.com/mbuckbee/Qrackajack-Gem.git'
Making a Request
> require 'qrackajack'
=> true
# Note: the 'Controller' here is not a reference to Rails controllers
# but an internal structure, won't interfere with your Rails app and will
# work fine in a standalone ruby app or another framework
> q = Qrackajack::APIController.new
> data = q.lookup("http://www.expeditedssl.com","100","100","#000000","#ffffff")
# Writes the file to the local directory, 'data' is the qr code returned
> File.open("my-qr-code.png", 'w'){|f| f.write(data)}
Using with PHP
<?php
$ch = curl_init('https://qrackajack.expeditedaddons.com/?api_key=' . getenv('QRACKAJACK_API_KEY') . '&bg_color=%23ffffff&content=http%3A%2F%2Fexample.org&fg_color=%23000000&height=256&width=256');
$response = curl_exec($ch);
curl_close($ch);
var_dump($response);
Using with Python
import os
from urllib2 import Request, urlopen
request = Request('https://qrackajack.expeditedaddons.com/?api_key=' + os.environ['QRACKAJACK_API_KEY'] + '&bg_color=%23ffffff&content=http%3A%2F%2Fexample.org&fg_color=%23000000&height=256&width=256')
response_body = urlopen(request).read()
print response_body
Using with Node
var request = require('request');
request('https://qrackajack.expeditedaddons.com/?api_key=' + process.env.QRACKAJACK_API_KEY + '&bg_color=%23ffffff&content=http%3A%2F%2Fexample.org&fg_color=%23000000&height=256&width=256', function (error, response, body) {
console.log('Status:', response.statusCode);
console.log('Headers:', JSON.stringify(response.headers));
console.log('Response:', body);
});
Using with Java
// Maven : Add these dependencies to your pom.xml (java6+)
// <dependency>
// <groupId>org.glassfish.jersey.core</groupId>
// <artifactId>jersey-client</artifactId>
// <version>2.8</version>
// </dependency>
// <dependency>
// <groupId>org.glassfish.jersey.media</groupId>
// <artifactId>jersey-media-json-jackson</artifactId>
// <version>2.8</version>
// </dependency>
import javax.ws.rs.client.Client;
import javax.ws.rs.client.ClientBuilder;
import javax.ws.rs.client.Entity;
import javax.ws.rs.core.Response;
import javax.ws.rs.core.MediaType;
Client client = ClientBuilder.newClient();
Response response = client.target('https://qrackajack.expeditedaddons.com/?api_key=' + System.getenv('QRACKAJACK_API_KEY') + '&bg_color=%23ffffff&content=http%3A%2F%2Fexample.org&fg_color=%23000000&height=256&width=256}')
.request(MediaType.TEXT_PLAIN_TYPE)
.get();
System.out.println("status: " + response.getStatus());
System.out.println("headers: " + response.getHeaders());
System.out.println("body:" + response.readEntity(String.class));
Dashboard
The Qrackajack dashboard allows you to monitor your API usage limits.
The dashboard can be accessed via the CLI:
$ heroku addons:open qrackajack
Opening qrackajack for sharp-mountain-4005
or by visiting the Heroku Dashboard and selecting the application in question. Select Qrackajack from the Add-ons menu.
Troubleshooting
As a sanity check it is sometimes useful to bypass your app stack and check the endpoint, your API Key and parameters directly.
Test with your browser
# Modify the following to use your actual API Key
https://qrackajack.expeditedaddons.com/?api_key=REPLACE_WITH_YOUR_QRACKAJACK_API_KEY&bg_color=%23ffffff&content=http%3A%2F%2Fexample.org&fg_color=%23000000&height=256&width=256
A successful call will return your requested data with a HTTP result code of 200
along with your data. We recommend the JSON Formatter extension as a useful tool.
Your API key can be found on your Qrackajack dashboard.
Migrating between plans
No downtime or disruption of service will occur as you modify your plans.
Use the heroku addons:upgrade
command to migrate to a new plan.
$ heroku addons:upgrade qrackajack:newplan
-----> Upgrading qrackajack:newplan to sharp-mountain-4005... done, v18 ($49/mo)
Your plan has been updated to: qrackajack:newplan
Removing the add-on
Qrackajack can be removed via the CLI.
This will destroy all associated data, cannot be undone and will immediately block access to the API
$ heroku addons:destroy qrackajack
-----> Removing qrackajack from sharp-mountain-4005... done, v20 (free)
Support
All Qrackajack support and runtime issues should be submitted via one of the Heroku Support channels. Any non-support related issues or product feedback is welcome at support@expeditedaddons.com