Retrieve a QR Image

POST /api/v1/download-image

Common errors include:

  • "Bad Request" if body parameters are not passed
  • "DNS_CONFIGURATION_ERROR" if custom domain DNS is misconfigured.

The createQrCodeHandler creates a qr code for the input body and returns the reponse to users

Request

Method : POST
Content-Type : Application/json

URL Parameters Schema

payload object Required
QR code configuration object
payload.size number Required
Size of QR code in pixels
payload.data string Required
Data to encode in QR code
payload.configobject
Default: {}
QR code styling configuration
payload.download boolean
Default: FALSE
Whether to download the QR code
payload.file string
Default: png
File format (png, jpg, svg)
LANGUAGE
REQUEST
  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"
  }'
API REQUEST
 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));
  });
};
API REQUEST
 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));
  });
};
API REQUEST
  $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);
API REQUEST
 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}")
RESPONSE
  {
  "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" }