Denda Vivas

IMG-ZPL

API URL:

                            

Method:POST

https://image-zpl.denda.ro/api/v1/image-to-zpl/convert/<<Api KEY>>

Parametri:

  • url_imagesursa fișierului <<https://exemple.com/file.png/jpg/...>>.
    *doar https in caz contrar va aparea eroarea <<"code": "ERR_INVALID_PROTOCOL">>
  • width & height → specifica dimensiunile exacte ale codului zpl, pentru a permite încadrarea in diferite formate (A4,A6...).
    *doar valori numerice sau <<null>> (va preloa dimeniunile initiale ale fisierului)
  • horizontalSpace → plasarea pe orizontala a conținutului *doar valori numerice
  • verticalSpace → plasarea pe verticala a conținutului *doar valori numerice
                            

'Content-Type': 'application/json' { "url_image" : "https://exemple.com/file.png/jpg/...", "width" : 750 or null, "height" : 1100 or null, "horizontalSpace" : 30, "verticalSpace" : 50 }

Fragment de cod:

                                let  header = new Headers();
                                header.append("Content-Type", "application/json");
                                
let data = JSON.stringify({ "url_image": "https://exemple.com/file.png/jpg....", "width": 750, "height": 1100, "horizontalSpace": 30, "verticalSpace": 50 });
let options = { method: 'POST', headers: header, body: data, redirect: 'follow' };
fetch("https://image-zpl.denda.ro/api/v1/image-to-zpl/convert/<<APY KEY>>", options) .then(response => response.json()) .then(result => console.log(result)) .catch(error => console.log('error', error));
                                const axios = require('axios');
                                
let data = JSON.stringify({ "url_image": "https://exemple.com/file.png/jpg...", "width": 800, "height": 1100, "horizontalSpace": 30, "verticalSpace": 50 });
let config = { method: 'post', url:"https://image-zpl.denda.ro/api/v1/image-to-zpl/convert/<<APY KEY>>", headers: { 'Content-Type': 'application/json' }, data : data };
axios(config) .then(function (response) { console.log(JSON.stringify(response.data)); })
.catch(function (error) { console.log(error); });
                                <?php
                                
$curl = curl_init();
curl_setopt_array($curl, array( CURLOPT_URL => 'https://image-zpl.denda.ro/api/v1/image-to-zpl/convert/<<APY KEY>>', CURLOPT_RETURNTRANSFER => true, CURLOPT_ENCODING => '', CURLOPT_MAXREDIRS => 10, CURLOPT_TIMEOUT => 0, CURLOPT_FOLLOWLOCATION => true, CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1, CURLOPT_CUSTOMREQUEST => 'POST', CURLOPT_POSTFIELDS =>'{ "url_image":"https://exemple.com/file.png/jpg....", "width":800, "height":1100, "horizontalSpace":30, "verticalSpace":50 }', CURLOPT_HTTPHEADER => array( 'Content-Type: application/json' ), ));
$response = curl_exec($curl); if (curl_errno($curl)) { print "Error: " . curl_error($curl); } echo '<pre>'; print_r($response); echo '<pre>'; curl_close($curl);
                                    let settings = {
                                    "url": "https://image-zpl.denda.ro/api/v1/image-to-zpl/convert/<<APY KEY>>",
                                    "method": "POST",
                                    "timeout": 0,
                                    "headers": {
                                    "Content-Type": "application/json"
                                    },
                                    
                                    
"data": JSON.stringify({ "url_image": "https://exemple.com/file.png/jpg.....", "width": 750, "height": 1100, "horizontalSpace": 50, "verticalSpace": 30 }), }
$.ajax(settings).done(function (response) { console.log(response); });

Răspunsul cererilor:

Apare atunci când toate funcțiile sau executat fără problema.

                                {
                                    "status":"success",
                                    "message":"Itelligent Image-ZPL Convertor",
                                    "zpl":"ZPL CODE"
                                }
                            

Apare atunci când URL sitului este invalid sau nu conține fișierul respectiv.

                                {
                                    "status":"failed",
                                    "message":"url invalid"
                                }
                        

Apare atunci când api key-ul specificat nu este indetificat in baza de date.

                                {
                                    "status":"failed",
                                    "message":"Invalid Api Key"
                                }
                        

Poate fi cauzata de salvarea incorecta a imagini.

                            {
                                "status":'failed',
                                "message":'failed to extract data from image',
                                "code":'ERR_INVALID_PROTOCOL'
                            }
                        

Poate fi cauzata de o eroare in conversie:

                                    {
                                        "status":'failed',
                                        "message":'failed to convert  image to zpl',
                                        "code":((error))
                                    }
                            

API URL:

                            

Method:POST

https://image-zpl.denda.ro/api/v1/image-to-zpl/print/<<Api KEY>>

Parametri:

  • ip → adresa ip a router-ului.
  • port → port-ul imprimantei.
  • zpl → codul zpl.
                            

'Content-Type': 'application/json' { "ip" : "127.0.0.1", "port" : 5000, "zpl" : "^XA^FDHello World^XZ~PS" }

Fragment de cod:

                                let  header = new Headers();
                                header.append("Content-Type", "application/json");
                                
let data = JSON.stringify({ "ip": "127.0.0.1", "port": 5000, "zpl": "^XA^FDHello World^XZ~PS" });
let options = { method: 'POST', headers: header, body: data, redirect: 'follow' };
fetch("https://image-zpl.denda.ro/api/v1/image-to-zpl/print/<<APY KEY>>", options) .then(response => response.json()) .then(result => console.log(result)) .catch(error => console.log('error', error));
                                const axios = require('axios');
                                
let data = JSON.stringify({ "ip": "127.0.0.1", "port": 5000, "zpl": "^XA^FDHello World^XZ~PS" });
let config = { method: 'post', url:"https://image-zpl.denda.ro/api/v1/image-to-zpl/print/<<APY KEY>>", headers: { 'Content-Type': 'application/json' }, data : data };
axios(config) .then(function (response) { console.log(JSON.stringify(response.data)); })
.catch(function (error) { console.log(error); });
                                <?php
                                
$curl = curl_init();
curl_setopt_array($curl, array( CURLOPT_URL => 'https://image-zpl.denda.ro/api/v1/image-to-zpl/print/<<APY KEY>>', CURLOPT_RETURNTRANSFER => true, CURLOPT_ENCODING => '', CURLOPT_MAXREDIRS => 10, CURLOPT_TIMEOUT => 0, CURLOPT_FOLLOWLOCATION => true, CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1, CURLOPT_CUSTOMREQUEST => 'POST', CURLOPT_POSTFIELDS =>'{ "ip":"127.0.0.1", "port":5000, "zpl":"^XA^FDHello World^XZ~PS" }', CURLOPT_HTTPHEADER => array( 'Content-Type: application/json' ), ));
$response = curl_exec($curl); if (curl_errno($curl)) { print "Error: " . curl_error($curl); } echo '<pre>'; print_r($response); echo '<pre>'; curl_close($curl);
                                    let settings = {
                                    "url": "https://image-zpl.denda.ro/api/v1/image-to-zpl/print/<<APY KEY>>",
                                    "method": "POST",
                                    "timeout": 0,
                                    "headers": {
                                    "Content-Type": "application/json"
                                    },
                                    
                                    
"data": JSON.stringify({ "ip": "127.0.0.1", "port": 5000, "zpl": "^XA^FDHello World^XZ~PS" }), }
$.ajax(settings).done(function (response) { console.log(response); });

Răspunsul cererilor:

Apare atunci când toate funcțiile sau executat fără problema.

                                {
                                    "status":"success",
                                    "message":"Itelligent Image-ZPL Convertor - successful printing.",
                                    "ip":"127.0.0.1",
                                    "port":5000,
                                    "zpl":"ZPL CODE"
                                }
                            

Apare atunci când sunt probleme cu conexiunea pe baza adrese ip / port dintre server si imprimanta.

                                {
                                    "status":"failed",
                                    "error":{print error},
                                    "ip":"127.0.0.1",
                                    "port":5000
                                }