result := HTTPCALL( url, httpmethod, responsemimetype, outstructure [, options ] );
result | The definition name for the resulting recordset. |
url | A string containing the URL that hosts the service to invoke. This may contain parameters to the service. |
httpmethod | A string containing the HTTP Method to invoke. Valid methods are: "GET" |
responsemimetype | A string containing the Response MIME type to use. Valid types are: "text/xml" |
outstructure | A RECORD structure containing the output field definitions. For an XML-based responsemimetype these should use XPATH to specify the exact data path. |
options | A comma-delimited list of optional specifications from the list below. |
HTTPCALL is a function that calls a REST service.
Valid options are:
Example:
worldBankSource := RECORD STRING name {XPATH('name')} END; OutRec1 := RECORD DATASET(worldBankSource) Fred{XPATH('/source')}; END; raw := HTTPCALL('http://api.worldbank.org/sources', 'GET', 'text/xml', OutRec1, ); OUTPUT(raw); ////Using HTTPHEADER to pass Authorization info raw2 := HTTPCALL('http://api.worldbank.org/sources', 'GET', 'text/xml', OutRec1, HTTPHEADER('Authorization','Basic dXNlcm5hbWU6cGFzc3dvcmQ='), HTTPHEADER('MyLiteral','FOO')); OUTPUT(raw2);