HTTPBLOB

The HTTPBLOB REST function completes an HTTP request with the specified HTTP verb. Response messages from the server are returned as BLOB data.

Tip: The sample HTTP user-defined functions are intended to be used within Db2 SQL applications to access remote non-Db2 REST-based services through SQL statements. Do not confuse them with Db2 native REST services, which supports using a REST-based interface to interact with Db2 data from web, mobile, and cloud applications.
Read syntax diagramSkip visual syntax diagramHTTPBLOB( url, method,httpHeader,<input>)

The schema is DB2XML.

url
Specifies the URL at which to complete the request. This argument is defined as a VARCHAR(2048) value.
method
Specifies the HTTP verb to use. Valid values are GET, POST, PUT, and DELETE.
httpHeader
Specifies an optional header XML document. This argument is defined as a CLOB(10K) value.

The XML header document can provide additional HTTP header values in the following format:

<httpHeader headerAttribute="headerAttributeValue">
        <header name="name" value="value" />
</httpHeader>
headerAttribute
Specify any of the following optional attributes:
connectTimeout
Specifies an integer value for the connection timeout threshold in milliseconds.
readTimeout
Specifies an integer value for the read timeout threshold in milliseconds.
followRedirects
Specifies whether redirects should be followed. This is a boolean value.
useCaches
Specifies whether caches should be used. This is a boolean value.
responseMsgFormat
Specifies the header attribute value errorTagged, to indicate that when the server returns an error message to the user-defined function, the user-defined function returns the following values to the caller:
  • SQLCODE 0
  • The error message from the server, in the following format:
    <error httprc="{HTTP-status-code}">
      {error-message-returned-from-server}
    </error>
headerAttributeValue
Specifies a value for the headerAttribute. Separate headerAttribute and headerAttributeValue combinations with single spaces.
name
The header name.
value
The header value.
<input>
Specifies the data to update at the specified URL. This argument is defined as BLOB(5M).