USING co.dsg.http.*.
DEFINE VARIABLE objHttp AS CLASS http NO-UNDO.
DEFINE VARIABLE objHttpRequest AS CLASS httpRequest NO-UNDO.
DEFINE VARIABLE objHttpResponce AS CLASS httpResponce NO-UNDO.
/* Create a new HTTP Client class object. */
objHttp = NEW http().
/* Create a new HTTP Client Request class object. */
objHttpRequest = NEW httpRequest().
/** Set the HTTP Request Method to 'GET' **/
objHttpRequest:HttpMethod = 'GET'.
/** Enter the AUS Post API Auth Key here....**/
objHttpRequest:AddHeader('AUTH-KEY', 'abcd1234foobar').
objHttpRequest:AddParam('from_postcode','2055'). /* Somewhere is Sydney*/
objHttpRequest:AddParam('to_postcode','3000').
objHttpRequest:AddParam('length','18'). /** 18CM **/
objHttpRequest:AddParam('width','23'). /** 23CM **/
objHttpRequest:AddParam('height','12'). /** 12CM **/
objHttpRequest:AddParam('weight','0.5). /** 500g (Half Kilo)**/
/** Depending on what SERVER response you require either JSON or XML, comment/un-comment the following code. **/
/** Expecting and JSON response **/
/* objHttpRequest:AddHeader('Accept','application/json'). */
/* objHttpRequest:path = '/api/postage/letter/domestic/thickness.json'. */
/** Expecting and XML response **/
objHttpRequest:AddHeader('Accept', 'text/xml').
objHttpRequest:path = '/api/postage/parcel/domestic/size.xml'. /* see the AUS Post API for more details.. */
/* This returns a HTTP Reponce class object */
objHttpResponce = objHttp:SynchronousRequest( 'https://auspost.com.au', objHttpRequest ).
/** Your server response is here...**/
MESSAGE
STRING( objHttpResponse:body )
VIEW-AS ALERT-BOX INFO.
DELETE OBJECT objHttpRequest.
DELETE OBJECT objHttp.