1. Craig Bristol
  2. PowerBuilder
  3. Thursday, 2 April 2020 17:14 PM UTC

I am using PB 2019.  I  have created a HTTPClient object to retrieve data into a datawindow.  When it gets to the line

     ll_rows = rest.RetrieveOne( dw_1, "https://mymeded.com/course_credit_awarded")

it returns -4,  I can't find out what -4 means?  Can anyone tell me what this means or where I can find the answer?

 

 

 

Chris Pollach @Appeon Accepted Answer Pending Moderation
  1. Thursday, 2 April 2020 19:29 PM UTC
  2. PowerBuilder
  3. # 1

Hi Craig;

   FYI: From the PB Help ....

Return value
Long

Returns values as follows. If any argument's value is null, the method returns null.

>=0 -- Returns the number of rows if it succeeds
-1 -- General error
-2 -- Invalid URL
-3 -- Cannot connect to the Internet
-4 -- Timed out
-7 -- Failed to decompress data
-10 -- The token is invalid or has expired
-15 -- Unsupported character sets

HTH

Regards ... Chris

Comment
There are no comments made yet.
Craig Bristol Accepted Answer Pending Moderation
  1. Thursday, 2 April 2020 18:14 PM UTC
  2. PowerBuilder
  3. # 2

My mistake, I am using RestClient.  I don't know why I typed HTTPClient. 

Comment
There are no comments made yet.
Kevin Ridley Accepted Answer Pending Moderation
  1. Thursday, 2 April 2020 18:13 PM UTC
  2. PowerBuilder
  3. # 3

Can only see the one line of code you posted, but I'm guessing that you actually did use the RestClient and maybe just typed HTTPClient in your post by mistake?  If you did use the RestClient and it's returning -4, that means it timed out.  There's a TimeOut property on the RestClient object that you can set to give it more time.  Are you able to get the service to work in a tool like SOAPUI or Postman?

 

KR

Comment
There are no comments made yet.
Armeen Mazda @Appeon Accepted Answer Pending Moderation
  1. Thursday, 2 April 2020 17:25 PM UTC
  2. PowerBuilder
  3. # 4

You need to use the RESTClient object not HTTPClient object to directly retrieve data from a REST API into a DataWindow.  The REST API needs to return data in a supported JSON structure, in this case it MUST be a single-level JSON structure since you want to use the RetrieveOne function.  Otherwise, you will need to first parse out the JSON data, format it properly for your DataWindow, and then use the ImportJSON function to import it into your DataWindow.

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.