I want to parse an image from an API call that it's response is an image in .jpeg format. I checked what we're receiving on the DMA and compared it with Postman. Something that's weird is that we're receiving less bytes on DMA than postman (missing a lot of data) See image below:
[Postman API call] [DMA API Call]I want to know what's the best way to parse it via QAction? I put the response parameter as a string (before converting it to byte[]). Is it necessary to configure the response param as a number?
As this question has been inactive for a long time, we will now close it. If you want further assistance, could you post a new question?
Hi German,
Try getting the data into the QAction as a byte[] instead of string using the code in the example on here: https://docs.dataminer.services/develop/api/types/Skyline.DataMiner.Scripting.SLProtocol.GetData.html
Using a normal GetParameter will cut-off the value at the first null char.
The parameter should be of type
<RawType>other</RawType>
<Type>string</Type>
Hi Thomas,
I added that code to process the incoming data but I received an exception error when I try to convert it back to Image. This is the line code I’m using to convert it:
Image image = (Bitmap)new ImageConverter().ConvertFrom(bytes);
and return the exception error:
System.ArgumentException: Parameter is not valid.
I don’t have any experience with image libraries.
The class name seems very generic, maybe check if that method is expecting bytes from another format instead of jpeg.
Hi German,
I noticed that this question has been open for some time now. Can you confirm if you have found a solution, so we can mark this question as solved?