HTTPPUTBLOB and HTTPPUTCLOB

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

Tip: Start of changeThe 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.End of change
Read syntax diagramSkip visual syntax diagramHTTPPUTBLOBHTTPPUTCLOB( url,httpHeader, <input>)

The schema is DB2XML.

url
Specifies the URL at which to create or 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:
Start of changeconnectTimeoutEnd of change
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.
Start of changeresponseMsgFormatEnd of change
Start of changeSpecifies 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>
End of change
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 create or update at the specified URL. This argument is defined as BLOB(5M) for HTTPPUTBLOB or CLOB(5M) for HTTPPUTCLOB.