1. Sivaprakash BKR
  2. PowerBuilder
  3. Monday, 8 April 2024 08:53 AM UTC

Hello,

Using PB 2022 R3

Need to a call API which sends a file along with other parameters.   It could be successfully sent from Postman using form-data, where there is an option to enter text or select a file option.  

Now need to send the same using HTTPClient.  

The last one document_file is actually a file name from local storage.  There is an option to select the file in Postman.  WHen I tried to hard-code the full file name, 

Accepted Answer
Sivaprakash BKR Accepted Answer Pending Moderation
  1. Saturday, 13 April 2024 12:47 PM UTC
  2. PowerBuilder
  3. # Permalink
Thanks mike S While googling I found a solution given by one of the community members [ Clint Maxwell ], here in his comment https://community.appeon.com/index.php/qna/q-a/httpclient-post-with-multipart-form#reply-7061 That's working fine in my test. Will integrate and do a thorough testing tomorrow.
Comment
There are no comments made yet.
mike S Accepted Answer Pending Moderation
  1. Monday, 8 April 2024 13:36 PM UTC
  2. PowerBuilder
  3. # 1

You are looking for multipart form support where the 'other parameters' are also in the body along with the binary file.

Powerbuilder does not have native support for generating nor parsing this. It really should be part of the httpclient set of objects.

 

You are in luck - Daryl Foster built one in powerscript:

 

Multi-part form parsing code for REST api responses and mime data - Appeon Community

 

Comment
  1. Sivaprakash BKR
  2. Tuesday, 9 April 2024 05:04 AM UTC
Thanks mike S

It looks like it works when we receive multi-part data. Or Am I wrong?

What I need is to send multi-part data.

  1. Helpful
  1. mike S
  2. Tuesday, 9 April 2024 13:05 PM UTC
of_generate
  1. Helpful
  1. mike S
  2. Tuesday, 9 April 2024 13:14 PM UTC
more background

https://community.appeon.com/index.php/qna/q-a/httpclient-4?limitstart=0#reply-41058



you could just append it all together yourself rather than use the mulitpart form object
  1. Helpful
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.
We use cookies which are necessary for the proper functioning of our websites. We also use cookies to analyze our traffic, improve your experience and provide social media features. If you continue to use this site, you consent to our use of cookies.