1. Daniel Ferrreira
  2. PowerBuilder
  3. Monday, 11 April 2022 16:59 PM UTC

Hi guys,

!'m calling a rest API from PB, but instead or returning a JSON, this API returns a PNG (QRCode, to be specific). When I use the code:

restClient.sendGetRequest(as_url, as_jsonRet)

the as_jsonRet gets the content "PNG
"

How should I proceed as to get this image retrieved and displayed in PB? Below is a print as Postman returns it.

Thanks a lot!!!

 

 

 

Accepted Answer
Chris Pollach @Appeon Accepted Answer Pending Moderation
  1. Monday, 11 April 2022 17:20 PM UTC
  2. PowerBuilder
  3. # Permalink

Hi Daniel;

  Looks like you will need to return the image data stream into a Blob variable and then from there, transfer the BLob data stream into a Picture Control. Also, you might need to use the HTTPClient object class for this.

Regards ... Chris

Comment
  1. Kevin Ridley
  2. Friday, 15 April 2022 18:06 PM UTC
Note you can also put the blob data stream into a file and open the file if you don't want to use the picture control..
  1. Helpful
There are no comments made yet.
Daniel Ferrreira Accepted Answer Pending Moderation
  1. Monday, 11 April 2022 17:49 PM UTC
  2. PowerBuilder
  3. # 1

Because there isn't a SendGetRequest from the restClient object that receives a blob, only strings, correct?

Comment
  1. Armeen Mazda @Appeon
  2. Monday, 11 April 2022 17:56 PM UTC
JSON is text not binary so you need to Base64 encode the binary to text to be JSON format.
  1. Helpful
There are no comments made yet.
Armeen Mazda @Appeon Accepted Answer Pending Moderation
  1. Monday, 11 April 2022 17:24 PM UTC
  2. PowerBuilder
  3. # 2

Blobs need to be Base64 encoded.

Comment
There are no comments made yet.
  • Page :
  • 1


There are no replies made for this question yet.
However, you are not allowed to reply to this question.