HTTPPOSTBLOB and HTTPPOSTCLOB

The HTTPPOSTBLOB and HTTPPOSTCLOB REST functions update a binary or text-based resource under the specified URL through an HTTP POST request. Response messages from the server are returned as BLOB for HTTPPOSTBLOB or as CLOB for HTTPPOSTCLOB. The character set is converted into the database code page if necessary.

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 diagramHTTPPOSTBLOBHTTPPOSTCLOB( url,httpHeader, <input>)

The schema is DB2XML.

url
Specifies the URL at which to update the data. This argument is defined as a VARCHAR(2048) value.
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) for HTTPPOSTBLOB or CLOB(5M) for HTTPPOSTCLOB.