Upload a base64-Picture-String via event message (thinedge) to Cumulocity

What product/components do you use and which version/fix level are you on?


Is your question related to the free trial, or to a production (customer) instance?


What are you trying to achieve? Please describe it in detail.

I try to upload a picture to cumolocity. It is converted to a base64-String and I try to send it via an event message as a normal dictionary payload → image_string

event_msg_dict = {
	"time": event_time,
	"event_type": event_type,
	"child_type": self.MessageTopic,
	"text": text,
	"lot": HIBC_Code_Contents.LOT_Number,
	"ref": HIBC_Code_Contents.ProductCode,
	"producer": HIBC_Code_Contents.ManufacturerCode,
	"udi-type": udi_type,
	"udi-code": self.Content_String,
	"quality": self.ScanQuality,
	"test_status": self.TestStatus,
	"reason": self.Reason,
	"image_string": self.image_string,
	"location": location

Do you get any error messages? Please provide a full error message screenshot and log file.

The text over the error is part of the string for internal debug purposes. The Error below is ocurring, when we try to send a dictionary with this string included. If we try to send it without the string (simply commented out the entry but didnt change anything else) it will send the event-message just fine.

Have you installed all the latest fixes for the products and systems you are using?


Since the issue comes from that FS_Peripherals.py it makes sense to share that code.

Could you give some more infos why you want to do that? You could also add images via the file repository as well.

Specifically, the Event API supports attachments. That way the file is attached to the life cycle of the event.

My guess is that the body of your request is too large an rejected by the HTTP server. How large is the image you are trying to attach?

The Picture is aproximately 64KB, it varies a little bit depending on the actual object it is taken from.

Since we are using Thinedge to send our Data to Cumolocity, can you please specify under which MQTT-topic and with which payload we have to publish in order to upload the picture as a binary in the first place?

Ok, I assumed you were using HTTP. The API I linked to is not available via MQTT.

For MQTT the maximum message size is 16KB, so I assume you run into that limit:

1 Like

Ok, then how do I upload pictures with thinedge to Cumolocity?

or please suggest best practise to stream real images coming from devices.

Could you please tell us a bit about the use case.

Images can not be uploaded via mqtt directly but via Rest. There is currently an feature request open for that:


However you could handle the RestCall in your own plugin and attach it to an event. @Harald_Meyer referenced the API call already for that.

Is it possible through Device Integration using Smart Rest Templates?

We have now published image through thin edge topic and can be retrieved through events (UTF-8 Encoding)

Use case was simple, we need end to end streaming for our images through thin edge.
Still there is no component which supports decoding of image real time on UI

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.