Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Call Web API RESTful from VFP 9 app?
Message
General information
Forum:
Visual FoxPro
Category:
Other
Environment versions
Visual FoxPro:
VFP 9 SP2
OS:
Windows 10
Network:
Windows 2008 Server
Database:
MS SQL Server
Application:
Web
Miscellaneous
Thread ID:
01629204
Message ID:
01629232
Views:
3425
As others have pointed out West Wind Client Tools has support for making the HTTP as well as support for helping you deseraize the JSON data returned (or any that you may have to send). While there are other tools for doing HTTP calls with VFP, wwHttp has a bunch of additional features to facilitate sending and receiving data, plus tools to actually do something with the data that comes back - like deserializing and serializing JSON in the case of a typical REST service.
DO wwHttp
DO wwJsonSerializer

loSer = CREATEOBJECT("wwJsonSerializer")
lcJsonIn = loSer.Serialize(loPostObject)    && Some object or value to serialize

loHttp = CREATEOBJECT("wwHttp")
loHttp.cContentType = "application/json"
* loHttp.cHTTPVerb = "POST"  && not required for GET/POST but use for  PUT/DELETE/HEAD/OPTIONS etc,
loHttp.AddPostKey(lcJsonIn)  && raw post data

lcJsonResult = loHttp.HttpGet(lcUrl)

loResultObject = loSer.DeserializeJson(lcJsonResult)

*** Do something with the result object
? loResultObject.status
? loResultObject.Data.SummaryValue
More info:

* Access HTTP content from the Web
* wwJsonSerializer Class


+++ Rick ---

>Do you know if it is possible to call Web API RESTful (built on .NET) service from VFP 9 app? I am talking about passing a couple of values from VFP 9 app to the Web API?
>
>TIA
+++ Rick ---

West Wind Technologies
Maui, Hawaii

west-wind.com/
West Wind Message Board
Rick's Web Log
Markdown Monster
---
Making waves on the Web

Where do you want to surf today?
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform