The createQrCodeHandler creates a qr code for the input body and returns the reponse to users
curl -X GET 'https://divsly-backend.vercel.app/api/v1/qr-codes/123'
\
-H 'Authorization: Bearer YOUR_ACCESS_TOKEN'
const getQrCode = (id) => {
return new Promise((resolve, reject) => {
fetch(`https://divsly-backend.vercel.app/api/v1/qr-codes/${id}`, {
method: 'GET',
headers: {
'Authorization': 'Bearer YOUR_ACCESS_TOKEN',
'Content-Type': 'application/json'
},
// Note: Fetch API handles SSL verification differently from cURL
// For development, you might need to use a process.env.NODE_TLS_REJECT_UNAUTHORIZED = '0'
// But this is NOT recommended for production
})
.then(response => response.json())
.then(data => resolve(data))
.catch(error => reject(error));
});
};
getQrCode('123')
.then(data => console.log(data))
.catch(error => console.error('Error:', error));
const axios = require('axios');
const getQrCode = (id) => {
return new Promise((resolve, reject) => {
axios({
method: 'get',
url: `https://divsly-backend.vercel.app/api/v1/qr-codes/${id}`,
headers: {
'Authorization': 'Bearer YOUR_ACCESS_TOKEN'
},
// If needed for development (not recommended for production):
// httpsAgent: new https.Agent({ rejectUnauthorized: false })
})
.then(response => resolve(response.data))
.catch(error => reject(error.response?.data || error));
});
};
getQrCode('123')
.then(data => console.log(data))
.catch(error => console.error('Error:', error));
function getQrCode($id) {
$url = "https://divsly-backend.vercel.app/api/v1/qr-codes/" . $id;
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => $url,
CURLOPT_RETURNTRANSFER => true,
CURLOPT_SSL_VERIFYPEER => false, // Disable SSL peer verification
CURLOPT_SSL_VERIFYHOST => false, // Disable SSL host verification
CURLOPT_HTTPHEADER => [
"Authorization: Bearer YOUR_ACCESS_TOKEN",
"Content-Type: application/json"
]
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
return "Error: " . $err;
} else {
return json_decode($response, true);
}
}
# Python using requests
import requests
def get_qr_code(id):
url = f"https://divsly-backend.vercel.app/api/v1/qr-codes/{id}"
headers = {
"Authorization": "Bearer YOUR_ACCESS_TOKEN"
}
try:
response = requests.get(url, headers=headers)
return response.json()
except requests.exceptions.RequestException as e:
print(f"Error: {e}")
return None
{
"message": "Qr code retreive successfully!",
"success": true,
"resultData": {
"id": 1167,
"type": "qr",
"type2": null,
"userId": 92,
"clicks": 1,
"lbClicks": 0,
"scans": 0,
"destinationUrl": "https://divsly.com",
"faviconUrl": "assets/img/logo/favicon.png",
"title": "Preview",
"titleLabel": "preview",
"btnLabel": null,
"brandedDomain": "kut.lt",
"slashTag": "dye6y",
"edit": 0,
"utm_id": null,
"utm_content": null,
"utm_term": null,
"utm_campaign": null,
"utm_medium": null,
"utm_source": null,
"preset": "#000000",
"bgColor": "#ffffff",
"color": "#000000",
"pattern": "classy",
"corner": "square",
"logo": "886d912a169c986ca5f98c3450da9edaf3cdf137.png",
"qr": "//api.qrcode-monkey.com/tmp/807f36b526d53242cbdb35e73b0f363f.png",
"qrLogoId": "886d912a169c986ca5f98c3450da9edaf3cdf137.png",
"tags": "",
"linkInBioId": null,
"uniqueTagId": 1228,
"isActive": true,
"isStarred": false,
"expirationDate": "2025-06-25T06:21:29.854Z",
"createdAt": "2025-03-27T06:21:38.331Z",
"updatedAt": "2025-03-27T07:00:30.689Z",
"fieldData": "{\"destinationUrl\":\"https://divsly.com\",\"title\":\"Preview\",\"metaDescription\":\"\",\"brandedDomain\":\"kut.lt\",\"contentWelcomeImage\":\"\",\"contentWelcomeTime\":2.5,\"password\":\"\",\"passwordProtectionEnabled\":false}",
"frame": "",
"isadminblocked": false,
"isEdit": false,
"password": null,
"passwordProtectionEnabled": false,
"primary": "",
"qrType": "website",
"secondary": "",
"text": "Scan Me",
"textColor": ""
}
}
{
message: 'Qr code not retreive!',
success: false,
}
{
"message": "Unauthorized!"
}
{ "message": "Authorization is empty" }