Community Tip - When posting, your subject should be specific and summarize your question. Here are some additional tips on asking a great question. X
Hello everyone,
I have an entity with an image property which I would like to update from my edge device (note that I am working with the java sdk). Since it is actually a live stream from a camera I will update this image frequently (something like 2 or more per second).
It was suggested to me to use the fileTransferSubsystem for that, but I would prefer doing that with a PUT Rest request. Can anyone explain how to exactly send images like this? I am using postman for testing and using the following headers and parameters:
address: https://serverIP:Port/Thingworx/Things/Camera/Properties/CurrentImage
accept and Content-type: application/json
appKey: theAppkey
body: {"CurrentImage": binaryEncodedImage}
I get a 200 OK response but the image is not updated. I think my image might be wrongly decoded so my main question is, which representation of the image should I put in the json body?
I get the images through a GET request from another server so in my java program the image can either be represented as a byte[] array, an inputStream or a simple Image object. For postman I also tried it with a .jpg as a binary.
I am thankfull for any suggestions.
Kind Regards,
Dominik
Edit: I already changed the configuration of the PlatformSubsystem to allow Request Method Switch and disabled filter content type
Solved! Go to Solution.
The image should be base64 format. Here is a working example: https://community.ptc.com/t5/ThingWorx-Developers/Uploading-an-image-through-REST-api-to-an-image-property/td-p/506613
Considering your use case with live stream from a camera, take a look at the video streaming widget: https://community.ptc.com/t5/ThingWorx-Developers/How-to-display-a-live-vedio-stream-on-Thingworx-mashup/m-p/507500/highlight/true#M5320
Best regards,
Cristina
The image should be base64 format. Here is a working example: https://community.ptc.com/t5/ThingWorx-Developers/Uploading-an-image-through-REST-api-to-an-image-property/td-p/506613
Considering your use case with live stream from a camera, take a look at the video streaming widget: https://community.ptc.com/t5/ThingWorx-Developers/How-to-display-a-live-vedio-stream-on-Thingworx-mashup/m-p/507500/highlight/true#M5320
Best regards,
Cristina
Thank you, I wasn't converting byteArray to base64 String