The createQrCodeHandler creates a qr code for the input body and returns the reponse to users
curl -X POST \
'https://divsly-backend.vercel.app/api/v1/download-image' \
-H 'Authorization: Bearer YOUR_JWT_TOKEN_HERE' \
-H 'Content-Type: application/json' \
-d '{
"imageUrl": "https://example.com/image.jpg"
}'
const downloadImage = (imageUrl) => {
return new Promise((resolve, reject) => {
fetch('https://divsly-backend.vercel.app/api/v1/download-image', {
method: 'POST',
headers: {
'Authorization': 'Bearer YOUR_JWT_TOKEN_HERE',
'Content-Type': 'application/json'
},
body: JSON.stringify({
imageUrl: imageUrl
})
})
.then(response => response.json())
.then(data => resolve(data))
.catch(error => reject(error));
});
};
const axios = require('axios');
const downloadImage = (imageUrl) => {
return new Promise((resolve, reject) => {
axios({
method: 'post',
url: 'https://divsly-backend.vercel.app/api/v1/download-image',
headers: {
'Authorization': 'Bearer YOUR_JWT_TOKEN_HERE',
'Content-Type': 'application/json'
},
data: {
imageUrl: imageUrl
}
})
.then(response => resolve(response.data))
.catch(error => reject(error.response.data));
});
};
$data = array(
'imageUrl' => 'https://example.com/image.jpg'
);
$ch = curl_init('https://divsly-backend.vercel.app/api/v1/download-image');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($data));
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);
curl_setopt($ch, CURLOPT_HTTPHEADER, array(
'Authorization: Bearer YOUR_JWT_TOKEN_HERE',
'Content-Type: application/json'
));
$response = curl_exec($ch);
$httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
curl_close($ch);
$result = json_decode($response, true);
print_r($result);
import requests
import json
url = 'https://divsly-backend.vercel.app/api/v1/download-image'
headers = {
'Authorization': 'Bearer YOUR_JWT_TOKEN_HERE',
'Content-Type': 'application/json'
}
data = {
'imageUrl': 'https://example.com/image.jpg'
}
try:
response = requests.post(
url,
headers=headers,
json=data
)
response.raise_for_status()
print(response.json())
except requests.exceptions.RequestException as e:
print(f"Error: {e}")
{
"success": true,
"data": {
"type": "Buffer",
"data": [
137, 80, 78, 71, 13, 10, 26, 10, 0, 0, 0, 13,
73, 72, 68, 82, 0, 0, 1, 244, 0, 0, 1, 244,
8, 6, 0, 0, 0, 237, 225, 62, 99, 0, 0, 0,
// ... more bytes
]
}
}
{
message: 'Qr code not retreive!',
success: false,
}
{
"message": "Unauthorized!"
}
{ "message": "Authorization is empty" }