QR Code Generation
To generate a QR Code you need to call the tracking/qrcodes/generator/generate method. Here is a sample XML request:
<request>
<application>tracking</application>
<package>qrcodes</package>
<controller>generator</controller>
<action>generate</action>
<key>xx233QSBXIabGfpo</key>
<timestamp>1337348098</timestamp>
<hash>
64982e2f92f5850780befd90f61f63e1d3358f6a536ee085f4ab36273e96f4d8
</hash>
<arguments>
<campaign_id type="integer">61</campaign_id>
<campaign_name type="string">campaign1</campaign_name>
<qrcode_notes type="string">blah blah</qrcode_notes>
<qrcode_name type="string">api code 2</qrcode_name>
<qrcode_type type="integer">2</qrcode_type>
<qrcode_arg arrindex="[url]" type="string">http://some-test</qrcode_arg>
<qrcode_color type="string">008000</qrcode_color>
<qrcode_bgcolor type="string">00FFFF</qrcode_bgcolor>
<qrcode_design type="integer">2</qrcode_design>
<qrcode_point_size type="integer">20</qrcode_point_size>
<qrcode_border type="integer">2</qrcode_border>
<qrcode_error_correction type="string">M</qrcode_error_correction>
<qrcode_track type="integer">1</qrcode_track>
<qrcode_get_geolocation type="integer">0</qrcode_get_geolocation>
<qrcode_redirect_geolocation type="integer">0</qrcode_redirect_geolocation>
<qrcode_track_minimum type="integer">0</qrcode_track_minimum>
<qrcode_foreground_image filename="front.png">
(blob of base64 encoded picture)
</qrcode_foreground_image>
<qrcode_background_image filename="back.png">
(blob of base64 encoded picture)
</qrcode_background_image>
</arguments>
</request>
Here is the list of parameters of this method:
- campaign_id - the ID of the campaign in this this QR code should be placed. Leave 0 if you want a new campaign to be created (but campaign_name is required then - see below)
- campaign_name - the name of the campaign that is to be created for this code
- qrcode_notes - some additional info about the code - optional
- qrcode_name - name of the code (optional - if not provided the system will generate one)
- qrcode_type - designates the type of the QR Code according the table below (these are platform defined values, not inherent an inherent characteristic of the QR Code standard). This argument along with the actual qr code content (qrcode_arg parameter) are the most important ones.
QR Code type | value |
---|---|
Text | 1 |
URL | 2 |
Phone number |
3 |
SMS message |
4 |
Email address |
5 |
Email message |
6 |
VCard | 7 |
Google maps |
8 |
Social Network |
9 |
Twitter Status |
10 |
Youtube video for iPhone |
12 |
iTunes application |
13 |
Google Play market app |
14 |
Android WiFi network |
15 |
Blackberry PIN |
16 |
Smart application store |
18 |
Windows market |
19 |
Ovi store |
20 |
BlackBerry market |
21 |
- qrcode_arg - contains the actual data that needs to be encoded in the QR Code. For detailed description for each qrcode_type see the next section.
- qrcode_color - the foreground color in hex. Optional - defaults to black.
- qrcode_foreground_image - a file upload field. Please see the API Basics how to provide files. Both foreground color and image can be provided.
- qrcode_bgcolor - the background color in hex. Optional - defaults to white.
- qrcode_background_image - a file upload field. Please see the API Basics how to provide files. Both background color and image can be provided.
- qrcode_design - the shape of the QR Code blocks. The codes are as follows:
QR Code design | value |
---|---|
Square | 1 |
Rounded | 2 |
Circle |
3 |
Fuzzy 1 |
4 |
Fuzzy 2 |
5 |
Fuzzy 3 |
6 |
Liquid 1 |
7 |
Liquid 2 |
8 |
Liquid 3 |
9 |
Squares |
10 |
Circles |
11 |
Stars |
12 |
Curvy |
13 |
Blended square |
14 |
Blended rounded |
15 |
- qrcode_point_size - this is the size of the individual blocks of the code in pixels. This is an integer between 1 and 150. Please note that the Curvy and Liquid shapes are limited to 30 pixels block size. Please note that for the Blended types this is not used but instead calculated on the QR Code size and density. See further down in this document for more information about the Blended QR codes.
- qrcode_border - the border fo the QR code in blocks. It can be from 1 to 10.
- qrcode_error_correction - The error correction level for the QR Code expressed with a single character as per the table below:
Correction Level | Description | Value |
---|---|---|
Low | up to 7% of errors are corrected |
L |
Medium-Low | up to 15% of errors are corrected |
M |
Medium-High | up to 25% of errors are corrected |
Q |
High | up to 30% of errors are corrected |
H |
- qrcode_logo - a file upload field. Please see the API Basics how to provide files. The provided logo should in raster format and for best results should be a transparent PNG.
- qrcode_overlay - shall the provided logo be overlaid over the QR code or embedded (the blocks in the center will be automatically cleared as needed in order to make room for the logo). Defaults to 0 (not overlaid).
- qrcode_eye_center - the style of the center of the QR Code markers (eyes). For reference please see the table below:
QR Code Marker Center | value |
---|---|
Square | 1 |
Curved | 2 |
Dent Square |
3 |
Diamond |
4 |
Drop |
5 |
Leaf |
6 |
Right Eye |
7 |
Shear |
8 |
Shield |
9 |
Star |
10 |
Circles |
11 |
Twisted |
12 |
Wave |
13 |
Circle |
14 |
Squares |
15 |
- qrcode_eye_center_color - the color of the center provided in hex.
- qrcode_eye_border - the style of the border of the QR Code markers (eyes). For reference please see the table below:
QR Code Marker Border | value |
---|---|
Square | 1 |
Curved | 2 |
Dent Square |
3 |
Diamond |
4 |
Drop |
5 |
Leaf |
6 |
Right Eye |
7 |
Shield |
9 |
Stars |
10 |
Circle |
11 |
Twisted |
12 |
Wave |
13 |
Squares |
14 |
- qrcode_eye_border_color - the color of the border in hex.
- qrcode_blurred - shall the resulting QR Code be blurred. Defaults to 0 (not blurred). It is not supported for vector output.
- qrcode_start_left - used only by the Blended type QR Code. This is the left offset of the top left corner of the QR Code to the background image.
- qrcode_start_top - used only by the Blended type QR Code. This is the top offset of the top left corner of the QR Code to the background image.
- qrcode_size - used only by the Blended type QR Code. This is the targeted size of the QR Code.
- qrcode_blended_background_image - used only by the Blended type QR Code. This is the background picture. Please see the API Basics how to provide files.
- qrcode_track - shall the QR code be tracked. Defaults to 0 but it should be always set to 1 for the "Smart Application Link" type codes. This is an array type argument and in order to enable tracking it needs to be provided as follows:
QR Code Type | value of qrcode_track |
---|---|
Web Site URL |
qrcode_track[2] = 1 |
Text | qrcode_track[1] = 1 |
Google Maps Location |
qrcode_track[8] = 1 |
A Profile in the Social Networks |
qrcode_track[9] = 1 |
Update Twitter Status |
qrcode_track[10] = 1 |
YouTube Video for iPhone |
qrcode_track[12] = 1 |
iTunes App Link |
qrcode_track[13] = 1 |
Google Play App Link |
qrcode_track[14] = 1 |
Windows Marketplace App Link |
qrcode_track[19] = 1 |
Ovi Store App Link |
qrcode_track[20] = 1 |
BlackBerry Market App Link |
qrcode_track[21] = 1 |
Smart Application Link |
qrcode_track[17] = 1 |
Here is a sample how to provide the qrcode_track argument for the URL code type:
<qrcode_track arrindex="[2]" type="int">1</qrcode_arg>
- qrcode_track_minimum - shall only minimal information - date and time of the scan. Useful if you are looking for COPPA compliance. Defaults to 0.
- qrcode_get_geolocation - shall the ue asked to provide exact location. Defaults to 0.
- qrcode_redirect_geolocation - in the case when the geolocation popup is enabled if this option is enabled the user will be redirected to the target location in 3 seconds no matter did he/she answered the popup box. Defaults to 0.
The generation of QR Codes that are using the Self Hosted Tracking is not supported through the API.
List with all arguments for every QR Code type:
QR Code type | Type value | Arguments |
---|---|---|
Text | 1 |
|
URL | 2 |
|
Phone number |
3 |
|
SMS message |
4 |
|
Email address |
5 |
|
Email message |
6 |
|
VCard | 7 |
|
Google maps |
8 |
|
Social Network |
9 |
|
Twitter Status |
10 |
|
Youtube video for iPhone |
12 |
|
iTunes application |
13 |
|
Google Play market app |
14 |
Provide one_android_market_id OR one_android_market |
Android WiFi network |
15 |
|
Blackberry PIN |
16 |
|
Smart application store |
18 |
At least one argument must be provided. |
Windows market |
19 |
|
Ovi store |
20 |
|
BlackBerry market |
21 |
|
qrcode_arg[vcard_state]