1. mathews rutto
  2. PowerBuilder
  3. Wednesday, 25 November 2020 11:09 AM UTC

Hi,

How do i consume rest api with url image as one on the parameter response.

I need to call the image, download and store into a folder with reference no.

 

Happy for your response.

Brad Wery Accepted Answer Pending Moderation
  1. Thursday, 26 November 2020 14:58 PM UTC
  2. PowerBuilder
  3. # 1

If you have the URL for the image, you can request it and save it to a file. Scroll to the bottom portion of this post for an example:

https://powertothebuilder.blogspot.com/2020/08/develop-web-browser-in-powerbuilder.html

Using HttpClient, a request is sent out for a websites favicon. When the response comes back, we place the image bytes from the response body into a blob, then write that out to a file.

Comment
There are no comments made yet.
Kevin Ridley Accepted Answer Pending Moderation
  1. Wednesday, 25 November 2020 12:36 PM UTC
  2. PowerBuilder
  3. # 2

Is it possible to post the API?  Typically it's a byte array that you write to a file then display as you would normally display an image.  As far as a reference number, if the API provider has some sort of unique id as part of the API, you can use that, otherwise you'd have to create your own.  The api probably returns the image name and type so you should know what to name the file.  I did a Webinar and Elevate 2019 presentation on Using DropBox with PowerBuilder that shows how to use the DropBox REST API to upload files, download files and view folder contents.  You will probably find the download part helpful, images are one of the file types that I download.  Here's links to the demo and also the code on CodeXchange.  Good luck.

Kevin

https://www.youtube.com/watch?v=Qhola-1EJi8

https://community.appeon.com/index.php/codeexchange/powerbuilder/237-using-dropbox-rest-api-from-powerbuilder-code#307

 

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.