Skip to main content
1-Visitor
July 30, 2015
Question

How to post an image from ThingWorx to an external web server using REST API?

  • July 30, 2015
  • 2 replies
  • 1794 views

Hi All,

I am trying to post/send an image which is stored as a property in TW to an external web server using Rest API. I have used POSTImage snippet to try this out. But  I am getting the below error

Wrapped java.lang.Exception: Unable To Convert From [B to JSON Cause: Unable To Convert From [B to JSON


I am not very sure if  PostImage snippet is actually meant to meet the above requirement.

Is there any other way?

Thanks and Regards,

Vishal Vaidya

    2 replies

    1-Visitor
    July 30, 2015

    I'm pretty new to whole ThingWorx and havent' tried posting images but have you thought about base64 encoding the image as a string, submitting that, and converting back to image on ThingWorx side?

    This was just an idea on top of my head. Not that ThingWorx specific solution.

    vvaidya1-VisitorAuthor
    1-Visitor
    August 5, 2015

    Thanks Miikka,

    Even i thought the same but not sure how to encode image as string in Thingworx. Though there are snippet available but i have not come across any proper example where image is encoded in string or vice versa using base64EncodeBytes or similar services.

    Regards,

    Vishal Vaidya