- WinHttp.WinHttpRequest, which is built into Windows.
- West Wind Technologies' wwHTTP class, part of West Wind Internet & Client Tools and West Wind Web Connection.
- Chilkat Software’s Chilkat utility. Bill Anderson has a wrapper class that makes using Chilkat from VFP easier.
- CURL, a command-line utility that comes with Windows for transferring data to or from a server via a URL.
define class PetStoreAPI as BaseREST of BaseREST.prg
* Override parent properties.
cURL = 'https://petstore.swagger.io/v2/'
* Custom properties.
protected cAPIKey
cAPIKey = 'special-key'
nID = 0
&& the pet ID
cName = ''
&& the pet name
cStatus = ''
&& the pet's status
* Add a pet to the store.
function AddPet(toParameter)
This.AddQueryString('apikey', This.cAPIKey)
llReturn = This.APICall('POST', '200', 'pet', toParameter)
if llReturn
This.nID = This.oResponse.ID
endif llReturn
return llReturn
endfunc
* Find a pet.
function GetPet(tnPetID)
This.AddQueryString('apikey', This.cAPIKey)
llReturn = This.APICall('GET', '200', 'pet/' + transform(tnPetID))
if llReturn
This.cName = This.oResponse.Name
This.cStatus = This.oResponse.Status
endif llReturn
return llReturn
endfunc
* Handle errors.
protected function HandleErrors(toJSON)
if pemstatus(toJSON, 'type', 5) and toJSON.type = 'error'
This.cErrorMessage = toJSON.message
endif pemstatus(toJSON, 'type', 5) ...
endfunc
enddefine
(Another class that provides the pet information passed to AddPet isn't shown here for brevity.)
You can download VFPREST from https://github.com/DougHennig/VFPREST or add it to a project using FoxGet.
I'll be showing VFPREST at Virtual FoxFest 2026 so that's yet another reason to attend.
