Sign In

Making RESTful API calls

You can make RESTful API calls from your triggers or other PL/SQL code as follows:

CALL parasql_http( 'POST', -- either GET, POST, PUT, DELETE 'https://www.mydomain.com/endpoint?param1=value1...', -- URL JSON_OBJECT(...your post data...), -- optional request body in JSON format 'MyCallback', -- optional callback procedure NULL, -- optional callback data in JSON format NULL); -- optional http headers in JSON format
respCode INTEGER, respBody JSON, respHeaders JSON, callbackData JSON

Working with JSON data

There are a large number of functions available for parsing and generating data in JSON format. See the documentation here.

The parasql_http_request Table

This table logs all HTTP request/response data. You can query it for diagnostic purposes.

Column NameDatatypeComments
idBIGINT NOT NULL AUTO_INCREMENT PRIMARY KEYUnique request identifier.
request_timestampDATETIME NOT NULL DEFAULT CURRENT_TIMESTAMPTimestamp of request.
request_methodENUM ('GET','POST','PUT','DELETE') NOT NULL DEFAULT 'GET'Request method.
request_urlVARCHAR(2048) NOT NULLThe request URL.
request_headersJSONOptional. HTTP request headers in JSON format.
post_dataMEDIUMTEXTOptional. Should be called request_body. If this value is NOT NULL then 1) a Content-Length header will be computed and added automatically and 2) a Content-Type header will be added based upon the post_data_encoding column value.
post_data_encodingVARCHAR(255)Optional. The Content-Type header if post_data is NOT NULL. Default is application/x-www-form-urlencoded if not specified. application/json is the most common alternative and the default for requests made via the parasql_http() procedure.
response_statusINTHTTP response status code or -1 if an exception is thrown before a response is received.
response_headersJSONHTTP response headers in JSON format.
response_bodyMEDIUMTEXTHTTP response body or the exception text if response_status = -1
callback_procedureVARCHAR(64)Optional. The name of the stored procedure to be called for handling the response.
callback_statusVARCHAR(1024)Result of callback execution: either COMMIT or ROLLBACK with an associated error message.
opt_metadataJSONOptional. User defined metadata about the request. Useful for linking certain request/response behavior.
versionINTInternal version number. Determines how request/response parameters are processed.