QR Codes (Quick Response Codes) are used in a wide range of applications to allow users to instantly access information. The world has recently started to use QR codes in supermarkets and other retail stores to assist in covid-19 contact tracing. This means there is an increasing demand for many applications to facilitate convenient QR code generation.
Fortunately, some APIs provide that ability. Custom QR Code with Logo API is one such API that allows you to generate custom QR codes.
What is Custom QR Code with Logo API?
Custom QR code with logo API enables generating unique, high-quality QR codes with a logo, color, custom design, and shape. You can also export the output QR code image in various formats such as PNG, SVG, PDF, and EPS. Furthermore, this API allows creating custom transparent QR codes that can be used as an overlay for any background.
Custom QR Code with Logo API is a paid API with three pricing plans to choose from. It supports a variety of programming languages, including Python, PHP, Ruby, and Javascript. In this article, we will see how to use this API with multiple programming languages.
How does the Custom QR Code with Logo API work?
Custom QR code with logo API uses simple API logic as sending a request and obtaining the necessary response. When sending a request, it includes authentication parameters such as API key and host to let the server identify it as a valid request. The body of the API request contains the required parameters, which specify the customization details to generate the QR code. Once the API server has received and processed the request, it will send the appropriate response to the client in JSON format.
It will display the required information if the request is successful. For instance, the generated QR code will be the successful response of a request sent to the QR code generation endpoint. If the request is invalid or unsuccessful, the response payload will contain the error code and the details.
Target Audience for Custom QR Code with Logo API
Marketers/Advertisers
Many brands have shifted to branded QR codes from traditional black and white QR codes due to their appealing look and feel. This API provides just the same capability they need. Using this API, marketers and advertisers can generate colorful QR codes, including the company logo, and use them in marketing and advertising materials like posters, banners, cards, and brochures to promote businesses and create brand awareness.
Business Entities
This API allows businesses to use their logo with the QR code, which means they can have a professional-looking QR code with a unique identity. Therefore, Customers can easily recognize their brand and feel a sense of security. Thus, they can use these QR codes in their online websites for various purposes like directing the customers to their websites, payments, etc. Additionally, businesses can use this API to design business cards and use them in packaging.
Retailers
In this Covid-19 era, QR codes have become an essential element among retailers as it provides a touchless mechanism to grant entry to retail shops. Retailers require a custom QR code that preserves the quality when printed. Thus, this API is highly useful for them since it enables the instant creation of customized QR codes with high quality for printing purposes.
How to connect to the Custom QR Code with Logo API Tutorial – Step by Step
Step 1 – Sign up and Get a RapidAPI Account.
RapidAPI is the world’s largest API marketplace used by more than a million developers around the world. It can be used to search and connect to thousands of APIs using a single SDK, API key, and Dashboard.
To create a RapidAPI account, visit rapidapi.com and click on the “Sign Up” icon. You can use your Google, Github, or Facebook account for Single Sign-on (SSO) or create an account manually.
Step 2 – Search the API Marketplace
Navigate to the Marketplace and search for “Custom QR code with logo API.” Then, select the Custom QR code with logo API from the search results.
Step 3 – Subscribe to the API
We need to subscribe to this API to use it. Navigate to the “pricing” section of the API and subscribe to your preferred plan. For this article, we select the basic plan of the Custom QR code with logo API. Then, simply click on the “subscribe” button to pay and activate the subscription.
Step 4 – Test the API Subscription
After subscribing to the API, it is important to run a test for the endpoints. To do that, navigate to the “Endpoints” section of the API, which lists all the available endpoints.
Next, select the endpoint you want to test and add the required details. In this instance, we will select the “POST create custom QR code” to test. Each API endpoint contains code snippets in multiple languages, and it automatically adds the API keys.
Finally, click on the “Test Endpoint” Button to test the API. You will get the response with a 200 status code upon successful testing of an API endpoint. On the other hand, it will output an error code and message if there is an error in the request.
Custom QR Code with Logo API Endpoints
Currently, the Custom QR code with logo API has three endpoints, as shown in the following image.
Upload Image
This API endpoint is used to upload images that you want to add as a logo to your QR code. You need to define the “content-type” of the request as ‘multipart/form-data” and the name of the image form-field as ‘file.’ Then, you will get the ‘file’ value in the response. Use that value in the ‘logo’ parameter of the config object of ‘create custom QR code’ endpoints. You are allowed to upload PNG, JPG, and SVG file formats.
Create Custom QR Code
This endpoint is used to create custom QR codes with logos and designs. You can access it with both GET and POST requests. Besides, you have to specify the five parameters listed below as described in the API documentation of this endpoint when using it.
data
size
config
file
download
The ‘Config’ parameter is a JSON object that is used to define how your QR code should look like. It includes parameters to set the color, logo, and design. Some of the key parameters are,
body
– specifies the shape of the tiny figures in the QR codeeye
– defines the shape of the frames surrounding the position and alignment figures located in the cornerseyeball
– the shape of the figure inside the position and alignment figuresbodyColor
– the color of the QR code bodybgColor
– the color of the background.logo
– specifies the image to be embedded in the QR code. This can be the file name you get when uploading the image using the ‘Upload Image endpoint’ or an image URL.
Create Transparent QR Code
This endpoint is used to create transparent QR codes on a background image. You can access it using both GET and POST requests. Apart from the data, size, file, and download parameters in the second API endpoint, you need to specify the image here. It will be the background image or the image canvas of the QR code. The QR code will be transparent without a background image if an image is not specified. The size of the QR code is defined using the width and height, and you need to set the x and y positions of the QR code on the image canvas. If you set the ‘crop’ parameter, it will return only the QR code without the background image. The successful response of a request to this endpoint will look like the following.
Integrating Custom QR Code with Logo API to an Application
In this section, we will see how to integrate the Custom QR code with logo API into a software application using different programming languages such as Python, PHP, Ruby, and Javascript. To execute these code snippets, you need to install the specific programming language on your computer first. We will be using the “create custom QR code” GET endpoint for all the code snippets.
You can simply integrate the following code snippets into your application based on its language. You have to include the API-key and API-host parameters in the header of each code snippet.
Python Code Snippet (requests)
import requests url = "https://qrcode-monkey.p.rapidapi.com/qr/custom" payload = "{\r \"data\": \"https://www.qrcode-monkey.com\",\r \"config\": {\r \"body\": \"circle-zebra-vertical\",\r \"eye\": \"frame13\",\r \"eyeBall\": \"ball15\",\r \"erf1\": [],\r \"erf2\": [],\r \"erf3\": [],\r \"brf1\": [],\r \"brf2\": [],\r \"brf3\": [],\r \"bodyColor\": \"#0277BD\",\r \"bgColor\": \"#FFFFFF\",\r \"eye1Color\": \"#075685\",\r \"eye2Color\": \"#075685\",\r \"eye3Color\": \"#075685\",\r \"eyeBall1Color\": \"#0277BD\",\r \"eyeBall2Color\": \"#0277BD\",\r \"eyeBall3Color\": \"#0277BD\",\r \"gradientColor1\": \"#075685\",\r \"gradientColor2\": \"#0277BD\",\r \"gradientType\": \"linear\",\r \"gradientOnEyes\": false,\r \"logo\": \"#facebook\"\r },\r \"size\": 600,\r \"download\": false,\r \"file\": \"png\"\r }"
PHP Code Snippet (HTTP v2)
<?php $client = new http\Client; $request = new http\Client\Request; $body = new http\Message\Body; $body->append('{ "data": "https://www.qrcode-monkey.com", "config": { "body": "circle-zebra-vertical", "eye": "frame13", "eyeBall": "ball15", "erf1": [], "erf2": [], "erf3": [], "brf1": [], "brf2": [], "brf3": [], "bodyColor": "#0277BD", "bgColor": "#FFFFFF", "eye1Color": "#075685", "eye2Color": "#075685", "eye3Color": "#075685", "eyeBall1Color": "#0277BD", "eyeBall2Color": "#0277BD", "eyeBall3Color": "#0277BD", "gradientColor1": "#075685", "gradientColor2": "#0277BD", "gradientType": "linear", "gradientOnEyes": false, "logo": "#facebook" }, "size": 600, "download": false, "file": "png" }'); $request->setRequestUrl('https://qrcode-monkey.p.rapidapi.com/qr/custom'); $request->setRequestMethod('POST'); $request->setBody($body); $request->setHeaders([ 'content-type' => 'application/json', 'x-rapidapi-key' => 'cJvLRNK0GfdM9WSMbQe3inU7REn8JVy5', 'x-rapidapi-host' => 'qrcode-monkey.p.rapidapi.com' ]); $client->enqueue($request)->send(); $response = $client->getResponse(); echo $response->getBody();
Ruby (net::http)
require 'uri' require 'net/http' require 'openssl' url = URI("https://qrcode-monkey.p.rapidapi.com/qr/custom") http = Net::HTTP.new(url.host, url.port) http.use_ssl = true http.verify_mode = OpenSSL::SSL::VERIFY_NONE request = Net::HTTP::Post.new(url) request["content-type"] = 'application/json' request["x-rapidapi-key"] = 'cJvLRNK0GfdM9WSMbQe3inU7REn8JVy5' request["x-rapidapi-host"] = 'qrcode-monkey.p.rapidapi.com' request.body = "{\r \"data\": \"https://www.qrcode-monkey.com\",\r \"config\": {\r \"body\": \"circle-zebra-vertical\",\r \"eye\": \"frame13\",\r \"eyeBall\": \"ball15\",\r \"erf1\": [],\r \"erf2\": [],\r \"erf3\": [],\r \"brf1\": [],\r \"brf2\": [],\r \"brf3\": [],\r \"bodyColor\": \"#0277BD\",\r \"bgColor\": \"#FFFFFF\",\r \"eye1Color\": \"#075685\",\r \"eye2Color\": \"#075685\",\r \"eye3Color\": \"#075685\",\r \"eyeBall1Color\": \"#0277BD\",\r \"eyeBall2Color\": \"#0277BD\",\r \"eyeBall3Color\": \"#0277BD\",\r \"gradientColor1\": \"#075685\",\r \"gradientColor2\": \"#0277BD\",\r \"gradientType\": \"linear\",\r \"gradientOnEyes\": false,\r \"logo\": \"#facebook\"\r },\r \"size\": 600,\r \"download\": false,\r \"file\": \"png\"\r }" response = http.request(request) puts response.read_body
Javascript (Axios)
import axios from "axios"; const options = { method: 'POST', url: 'https://qrcode-monkey.p.rapidapi.com/qr/custom', headers: { 'content-type': 'application/json', 'x-rapidapi-key': 'cJvLRNK0GfdM9WSMbQe3inU7REn8JVy5', 'x-rapidapi-host': 'qrcode-monkey.p.rapidapi.com' }, data: { data: 'https://www.qrcode-monkey.com', config: { body: 'circle-zebra-vertical', eye: 'frame13', eyeBall: 'ball15', erf1: [], erf2: [], erf3: [], brf1: [], brf2: [], brf3: [], bodyColor: '#0277BD', bgColor: '#FFFFFF', eye1Color: '#075685', eye2Color: '#075685', eye3Color: '#075685', eyeBall1Color: '#0277BD', eyeBall2Color: '#0277BD', eyeBall3Color: '#0277BD', gradientColor1: '#075685', gradientColor2: '#0277BD', gradientType: 'linear', gradientOnEyes: false, logo: '#facebook' }, size: 600, download: false, file: 'png' } }; axios.request(options).then(function (response) { console.log(response.data); }).catch(function (error) { console.error(error); });
Alternative to Custom QR Code with Logo API
¥¥QR Code – An API that supports customizable QR code creation with images and styles.
@Custom QR Code – A simple API that lets you create QR codes with your own application, website, or industrial platform
QR Code Generator and Management – This API lets you create customized and dynamic QR codes with a logo to track users. Furthermore, it allows creating QR codes in bulk.
Benefits of the Custom QR Code with Logo API
Ease of Use
This API has simple endpoints with well-documented and easy-to-define request parameters. Additionally, the interface provides example code snippets in many programming languages, enabling even a novice developer to use this API easily.
Enables Customizations
You can define several customizations such as logo, size, background, and body color to match the logo. You can even create transparent QR codes. These customizations make QR codes unique and easily recognizable while providing them an appealing look and feel.
Saves cost
This API offers affordable pricing plans to suit your needs even though conventional advertising and marketing methods are usually costly. These QR codes can be used on any platform like social media, advertising materials like billboards, and brochures at the same cost.
Summary
The Custom QR code with logo API is a simple and easy-to-use API for generating customized QR codes with logos and designs. You can use it in a wide variety of applications. In this article, we have covered the available endpoints of this API and provided sample code snippets in Python, PHP, Ruby, and Javascript to show how to integrate it with an application.
Leave a Reply