[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: REST with JSON returned



   You want to use�http_url_get_raw().
   One of the parms is a procedure pointer, �that procedure is called
   with the data being returned. �   You need to write that procedure, in which you can simply save the
   returned data to a variable.�   Note that you're procedure will be called multiple times, once for each
   bit of data received.
   Also, the data passed to your procedure will be ASCII, so you'll
   probably want to convert it to EBCDIC.
   So you'll end up with something like so:
   �//Global Variables
   d Response � � � �s � � � �9999999a � varying
   � � � �Response = '';
   � � � �rc = http_url_get_raw(Url : 1 : %paddr(Process) : 60);
   � � � �//Do something with response, it is complete here
   p Process � � � � b
   D Process � � � � PI � � � � � �10I 0
   D � peFD � � � � � � � � � � � �10I 0 value
   D � peData � � � � � � � � � 65535A � options(*varsize)
   D � peLength � � � � � � � � � �10I 0 value
   � if peLength > 0;
   � � HTTP_xlate(peLength : peData : TO_EBCDIC);
   � � Response += %subst(peData : 1 : peLength);
   � ENDIF;
   � return peLength;
   p Process � � � � e

   On Thu, Feb 18, 2016 at 9:10 AM, Hayes, Daniel
   <[1]Daniel.Hayes@xxxxxxxxxxxxxxx> wrote:

     � �I am trying to consume a RESTful web service where the response
     will be
     � �in this format:
     � �{"ApNumber":32866062,"ApAmount":115.291}
     � �This is all I will get back.� I have gone through all of
     Scott's
     � �example programs and they always load the return into a file on
     the
     � �IFS, I just want it returned in a variable so I can parse this
     out.� I
     � �started out using Cozzi's iSockets, but he does not handle
     SSL.� Using
     � �that I just used `GetURLData'.� Is there an equivalent in
     HTTPAPI?
     � �Seems a little awkward to have my response go to the IFS and
     then have
     � �to pull it back in.
     � �Thanks,
     � �Danny Hayes
     � �     �__________________________________________________________________
     � �This communication is intended only for the use of the
     individual or
     � �entity named as the addressee. It may contain information which
     is
     � �privileged and/or confidential under applicable law. If you are
     not the
     � �intended recipient or such recipient's employee or agent, you
     are
     � �hereby notified that any dissemination, copy or disclosure of
     this
     � �communication is strictly prohibited. If you have received this
     � �communication in error, please immediately notify CareCentrix
     � �Compliance Hot Line at [2](877) 848-8229 and notify the sender
     by
     � �electronic mail. Please expunge this communication without
     making any
     � �copies. Thank you for your cooperation.
     --------------------------------------------------------------------
     ---
     This is the FTPAPI mailing list.� To unsubscribe, please go to:
     [3]http://www.scottklement.com/mailman/listinfo/ftpapi
     --------------------------------------------------------------------
     ---

References

   1. mailto:Daniel.Hayes@xxxxxxxxxxxxxxx
   2. tel:%28877%29%20848-8229
   3. http://www.scottklement.com/mailman/listinfo/ftpapi
-----------------------------------------------------------------------
This is the FTPAPI mailing list.  To unsubscribe, please go to:
http://www.scottklement.com/mailman/listinfo/ftpapi
-----------------------------------------------------------------------