Image Upload JSON or XML.

We need the json/xml body, what should we do to upload images to Lightspeed? We get the error in bold below (at the end).

We tried the following with no luck:

JSON

endpoint:

https://api.merchantos.com/API/Account/XXXX/Item/1/Image.json


body:

  "image":"ewogICAgImRlc2NyaXB0aW9uIjogIlRlc3QgSW1hZ2UiLAogICAgIm9yZGVyaW5nIjogMQp9",

  "filename":"279127_01.jpg",

  "data":{ 

     "description":"279127_01",

     "ordering":"1"

  }

}

In image field I am encoding a URL where the image is stored, not sure if I can send the URL itself?

XML

endpoint:

https://api.merchantos.com/API/Account/XXXX/Item/1/Image.xml


body:

<?xml version="1.0"?>

<Image xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">

    <filename>279127_01.jpeg</filename>

    <description />

    <itemID>1</itemID>

</Image>


No luck in any one (json and xml), I get an error..

{

   "httpCode": "500",

   "httpMessage": "Internal Server Error",

"message": "Argument 1 passed to pos\\image\\ImageStore::upload() must be of the type string, null given, called in /web/cloud/includes/controller/ItemImageBase.class.php on line 130",

   "errorClass": "TypeError"

3 comments

Sign In or Register to comment.