FoxPro Programming
Need to create a VFP 9.0 SP2 program that works with REST APIs
Gravatar is a globally recognized avatar based on your email address. Need to create a VFP 9.0 SP2 program that works with REST APIs
  Jason
  All
  Apr 10, 2019 @ 07:22am

I am trying to see if I can use VFP to work with REST APIs on a TelVue HyperCaster, https://telvue.com/kb/hc-apis/.

Several web searches have brought me to this site and FoxPro tools you seem to sell. (https://store.west-wind.com/products/FoxPro/)

I am looking at the West Wind Internet & Client Tools 7.0, but wondering about the West Wind Web Connection 7.0 as well. Are they both two seperate products, or is one included in the other?

And also, since I am very VERY new to programing of this type with VFP programing, what sort of tech support would be offered with purchasing either of them?

Thank you very much and SO glad I fould this site!

Jason...

Gravatar is a globally recognized avatar based on your email address. re: Need to create a VFP 9.0 SP2 program that works with REST APIs
  George
  Jason
  Apr 26, 2019 @ 04:32am

Hi,

I just used WebConnection classes to do exactly this, and it is (typical of Ricks tools) extremely capable.

If, like me, you are new to REST API work then I strongly recommend using POSTMAN to test your calls and examine the structures etc. If there are issues with your WEBCONNECTION implementation I also suggest using FIDDLER to capture the traffic between your DEV system and the API itself. There may be other, better, tools but these are commonly used and worked well for me.

Hope it all goes well.

George ...

Gravatar is a globally recognized avatar based on your email address. re: Need to create a VFP 9.0 SP2 program that works with REST APIs
  Jason
  George
  Apr 26, 2019 @ 05:45am

George,

Much thanks. I am rather new to REST APIs and I have seen POSTMAN, but have yet to really work with it. Thanks for the recommendations and I will certainly check it out. Still in the beginning phases of this project...

Jason...

Gravatar is a globally recognized avatar based on your email address. re: Need to create a VFP 9.0 SP2 program that works with REST APIs
  Rick Strahl
  Jason
  Apr 26, 2019 @ 04:44pm

Hi Jason,

So sorry, I totally missed your original message on this thread...

So, to follow up the original question, Web Connection is our server side tool that allows you to create a FoxPro Based Web Backend that lets you process Web Requests with FoxPro code on a Windows Web Server (IIS typically). Requests get routed to a FoxPro server and you can then use FoxPro code to interact with the request. Web Connection provides a host of tools to create HTML output, as well as service output for REST JSON Services.

The Client Tools provide Internet Connectivity protocol support for FoxPro so you can make HTTP calls, access SMTP servers, transfer files with FTP/FTPS etc. It also includes a host of other general purpose features. This library is a pick and choose your components style so typically you just grab the things you need and add them into your application. The things you'll likely be interested in will the Http library (wwHttp) and the JSON serialization and JSON Client tools.

The following topic outlines a lot of the HTTP related things that people typically do:

Web Connection includes all the features of the Client Tools as well, but you can't redistribute them outside of a server application. The client tools provide all the features for integration and runtime distribution with your own desktop or other applications.

Hope this helps clarify how these two tools relate to each other.

George pointed you at some good tools that you'll likely want to use when building or testing REST services especially an HTTP client testing tool like Postman or West Wind WebSurge which provides simialr functionality plus the ability to stress test your sites with the configured URLs.

+++ Rick ---

Gravatar is a globally recognized avatar based on your email address. re: Need to create a VFP 9.0 SP2 program that works with REST APIs
  Keith Hackett
  Jason
  Apr 29, 2019 @ 10:51am

Hi Jason,

In addition to what George and Rick have said, I can tell you that when it comes to adding web-based interaction to your VFP code (be it consuming REST resources or delivering up web content), I don't think you'll find better tools than West Wind's products! I've been using them for several clients for just over 20 years now.

Support for the product comes from the many great tutorials that Rick has provided as well as this support forum. It's a great bunch of VFP folks who'll quickly chime in to provide assistance if Rick (the creator of WWWC) doesn't beat them to it.

From what you described, it sounds like you'll want to look at the client tools. You can download a fully-operational demo version and check it out for yourself.

Just do it!:) I

Gravatar is a globally recognized avatar based on your email address. re: Need to create a VFP 9.0 SP2 program that works with REST APIs
  Jason
  Keith Hackett
  May 2, 2019 @ 04:23am

Much thanks, all!

I will admit I have been impressed with how often this site is referred to online, in the searches I have been doing to help with my latest project.

And Rick has been especially helpful with his information about what all the different products do.

From what I can tell so far, I am able to send and receive from my server's REST APIs, but right now I am concerned with error handling.

The Client Tools look like something we may need (thanks to Rick's clarification) and , if so, the technical help for the novice VFP programmer would be much needed as well.

Again, great site and service. Thanks.

Jason...

Gravatar is a globally recognized avatar based on your email address. re: Need to create a VFP 9.0 SP2 program that works with REST APIs
  Rick Strahl
  Jason
  May 2, 2019 @ 06:48pm

From what I can tell so far, I am able to send and receive from my server's REST APIs, but right now I am concerned with error handling.

What kind of error handling? For requests coming back from the server?

Errors are captured by the HTTP client and - if JSON error data comes back - from the service client that will automatically unpackage error messages which get deserialized just like a valid response (but with an error flag).

loProxy = CREATEOBJECT("wwJsonServiceClient")

lcUrl = "http://albumviewer.west-wind.com/api/album"
lvData = loAlbum && FoxPro object
lcVerb = "PUT"   && HTTP Verb

*** Make the service call and returns an Album object
loAlbum2 = loProxy.CallService(lcUrl,lvData,lcVerb)

*** If server returns JSON Errro
IF (loProxy.lError)
   IF VARTYPE(loAlbum2) == "O"
      ? loAlbum2.Message   && pick up the returned error message in object
   ELSE
      ? "An error occurred: " + loProxy.cErrorMsg
   ENDIF
   RETURN
ENDIF   

? loAlbum2.Title
? loAlbum2.Artist.ArtistName

This is low level code - ideally you'd want to wrap this call into a service method of your own inside of a subclass of wwJsonServiceClient and callit something like GetAlbums() that then returns either a list of albums or null, and has the error message set from any error information that was returned.

+++ Rick ---

© 1996-2019