Redirections allow fixed physical barcodes and QR codes to point to dynamically changing locations on the web. Each redirection resource associates a Thng or product, with the full URL it will redirect to. Each redirection is automatically assigned a short ID, which combined with the chosen short URL domain produces the short URL.
For example, a redirection created for a Thng could have the short ID df8f76hd
, in the tn.gg
short URL domain, resulting in its short URL becoming https://tn.gg/df8f76hd
. The redirection itself would instruct all visitors to that short URL to the full URL, such as https://brand.com/catalogue?product=UNwYkFVG9ef4wEwwap9XFqpn
.
See Resource Redirections for more conceptual information.
API Status
General Availability:
https://tn.gg/redirections
(inc. other short domains)
https://tn.gg/redirections
(inc. other short domains)RedirectionDocument Data Model
Create a Redirection
Thng and Product Redirections
It is possible to create a Thng or products' redirection directly on its resource. Read the Thngs and Products pages for more information.
To create a redirection for an EVRYTHNG resource it is required to specify the required parameter defaultRedirectUrl
to be used as a full URL for each access of the short URL. This could be a brand experience, product information, or some other brand-defined web location.
Note
The default response is a QR code image representing the redirection, unless the
accept
request header is set toapplication/json
.
Read a Redirection
Read a redirection to obtain information about the Thng associated with it. You can also read a short domain URL, for example: GET https://tn.gg/:shortId
.
Note
To be able to read the JSON metadata for the redirection, make sure to set the
Accept
header toapplication/json
.
Update a Redirection
Submit a new set of redirection information to dynamically change where the short ID will send the user.
Delete a Redirection
Delete a redirection. After this operation, the short link will no longer work.
Read all Redirections on a Thng
List all redirections associated to EVRYTHNG resource. The main parameter is evrythngId
, the ID of the resource possessing the redirection. Multiple redirections can be added to a single resource by making multiple redirection creation requests.
The output is an array of redirections associated with the resource.
Generate a QR Code
Once a short URL has been created in the Platform, you can easily generate a customizable QR code that contains the short URL, which can then be attached to the physical object. The QR code can be scanned using any standard bar code / QR code scanning application, which will point to the redirector and will be dynamically redirected to the target application.
Output Type
The accept
header is used to choose the :format
(the file format as a MIME type) of the generated QR code. Available formats:
image/png
(default, PNG bitmap image)image/svg+xml
(SVG vector)application/pdf
(vector PDF document)
You can also use alias endpoints to generate QR code in the preferred format:
PNG
GET https://tn.gg/:shortId.png
SVG
GET https://tn.gg/:shortId.svg
GET https://tn.gg/:shortId.pdf
Generations Options
The following query parameter options are available for QR code generation:
h
- The image height in pixels, from 95 to 800.w
- The image width in pixels, from 95 to 800.tpl
- The template for the QR code layout. Can be eitherdefault
ordefault-shortid
(including the short ID).ecl
- The error correction level required. Must be one ofL
,M
,Q
, orH
in ascending order of the amount of data redundancy added.
Because the short URL is fixed (23 characters, from which 10 are used for the shortId
), the QR code generated is version 2 (25x25 modules) using the error correction level Q (25% of error correction capacity).
An example QR code generation request is shown below for a large QR code with a high level of error correction applied:
https://tn.gg/EESmUazB.png?w=256&h=256&ecl=H&tpl=default