Sign In

Making API calls

You can make restful API calls from your triggers and stored procedures like this:

CALL parasql_http( 'POST', -- either GET, POST, PUT, DELETE '', -- URL JSON_OBJECT(...your post data...), -- optional request body in JSON format 'MyCallback', -- optional callback procedure NULL, -- optional metadata in JSON format NULL); -- optional http headers in JSON format
respCode INTEGER, respBody JSON, respHeaders JSON, optMetadata 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 most heavily used JSON functions are JSON_OBJECT() to create a JSON object and JSON_VALUE() to extract a value from a JSON document. You may also need JSON_LENGTH() to get the length of a JSON array.

Table - parasql_http_request

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

Column NameDatatypeComments
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. Useful for linking request/response behavior and diagnostic purposes.
versionINTInternal version number. Determines how request/response parameters are processed.

Love AppSynergy? Spread the Word...