Retrieve QR Images

POST /api/v1/qr-code/file-upload

Common errors include:

  • "400 Bad Request" if the file is missing or the file type is invalid.
  • "401 Unauthorized" if the request is not authorized.
  • "405 Method Not Allowed" if the HTTP method is unsupported.
  • "500 Internal Server Error" if the upload fails unexpectedly.

Handles file uploads for QR code images such as logos and backgrounds.

Request

Method : POST
Content-Type : multipart/form-data
Authentication : Bearer Token
Base URL : https://apis.divsly.com

Request Body Schema

file file Required
Image file to upload
supported image types string[]
jpg, jpeg, png, gif, webp, svg
supported audio types string[]
mp3, wav
supported video types string[]
mp4, mov
supported document types string[]
pdf
LANGUAGE
REQUEST
  curl -X POST \
  'https://apis.divsly.com/api/v1/qr-code/file-upload' \
  -H 'Authorization: Bearer YOUR_JWT_TOKEN_HERE' \
  -F 'file=@logo.png'
API REQUEST
 const uploadQrImage = (file) => {
  return new Promise((resolve, reject) => {
    const formData = new FormData();
    formData.append('file', file);

    fetch('https://apis.divsly.com/api/v1/qr-code/file-upload', {
      method: 'POST',
      headers: {
        'Authorization': 'Bearer YOUR_JWT_TOKEN_HERE'
      },
      body: formData
    })
      .then(response => response.json())
      .then(data => resolve(data))
      .catch(error => reject(error));
  });
};
API REQUEST
 const axios = require('axios');
const FormData = require('form-data');
const fs = require('fs');

const uploadQrImage = (filePath) => {
  return new Promise((resolve, reject) => {
    const formData = new FormData();
    formData.append('file', fs.createReadStream(filePath));

    axios({
      method: 'post',
      url: 'https://apis.divsly.com/api/v1/qr-code/file-upload',
      headers: {
        'Authorization': 'Bearer YOUR_JWT_TOKEN_HERE',
        ...formData.getHeaders()
      },
      data: formData
    })
      .then(response => resolve(response.data))
      .catch(error => reject(error.response.data));
  });
};
API REQUEST
  $data = array(
        'file' => new CURLFile('logo.png')
    );

    $ch = curl_init('https://apis.divsly.com/api/v1/qr-code/file-upload');
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
    curl_setopt($ch, CURLOPT_POST, true);
    curl_setopt($ch, CURLOPT_POSTFIELDS, $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'
    ));

    $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

url = 'https://apis.divsly.com/api/v1/qr-code/file-upload'
headers = {
    'Authorization': 'Bearer YOUR_JWT_TOKEN_HERE'
}

try:
    with open('logo.png', 'rb') as file_handle:
        response = requests.post(
            url,
            headers=headers,
            files={'file': file_handle}
        )
    response.raise_for_status()
    print(response.json())
except requests.exceptions.RequestException as e:
    print(f"Error: {e}")
RESPONSE
  {
  "message": "File uploaded successfully",
  "url": "https://s3.amazonaws.com/bucket/qr-preview/1712044800000-logo.png",
  "fileName": "logo.png",
  "size": 15234,
  "mimetype": "image/png"
}
    
  {
    "message": "Invalid file type or missing file"
}


  {
	"message": "Unauthorized!"
}


    

     { "message": "Method not allowed" }