1. VINOD NAIR
  2. PowerBuilder
  3. Monday, 12 August 2024 15:35 PM UTC

We are using PB 2019 R2 and there is requirement to call a REST API where in we need to send the contents of a CSV formatted file as its payload/body. How can we achieve this via code?

VINOD NAIR Accepted Answer Pending Moderation
  1. Monday, 12 August 2024 16:51 PM UTC
  2. PowerBuilder
  3. # 1

Hi Francisco,

 

Do you mean we use the below function, read the entire contents of the CSV file into a blob_data variable or is there another way to just point the file directly ?

objectname.SendRequest ( methodName, urlName, blob data )

 

Thanks,

Vinod

Comment
  1. Francisco Martinez @Appeon
  2. Monday, 12 August 2024 22:06 PM UTC
There is not, you will have to load the contents manually
  1. Helpful
There are no comments made yet.
Francisco Martinez @Appeon Accepted Answer Pending Moderation
  1. Monday, 12 August 2024 16:04 PM UTC
  2. PowerBuilder
  3. # 2

Hi Vinod,

 

I think you can use the HTTP Client and just post/put the contents of the file to the endpoint with either PostData or SendRequest. Remember to correctly set the Content-Type header to text/csv

 

Regards,
Francisco

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.
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.