Jump to content

I'm trying to upload image of items via Loyverse API


Recommended Posts

Posted

We have suffering error when try to upload image of item.

[

        $path = base_path() .'/public'. $itemImage->photo;

        $file = file_get_contents($path);

        $dataBinary = base64_encode($file);

                    $curl = curl_init();

                    curl_setopt_array($curl, array(

                    CURLOPT_URL => 'https://api.loyverse.com/v1.0/items/89a38ddc-e810-465b-a174-15c2245adfdf/image',

                    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 => $dataBinary,

                    CURLOPT_HTTPHEADER => array(

                        'Content-Type: image/png',

                        'Content-Length: 1000',

                        'Authorization: Bearer b94601bb9cfb44edbcxxxxxxxxxxxxxxxxx',

                    ),

                ));

                $response = curl_exec($curl);

                curl_close($curl);

                echo $response;

]

 

 

image.thumb.png.784fbeaf78cd83b8261b38975a281607.png

 

Please provide solution as soon as possible...

Thank You

Team Geoalgo

Posted

Hello, I'm will take look.

  • Like 1
Posted

Please try the same using Postman or any other sender with user interface, send to me example request and responses. It will help, find issue more faster. I'm not super familiar with php.

  • 1 year later...
Posted

Hi, get the same error.
Using .Net, HttpClient

image.thumb.png.106ebbb04dc421df59ec51b89c9af329.png

any luck what causes the error ?

Loyverse Point of Sale

 

 

 

 

×
×
  • Create New...