POST requests with an empty body
- Last Updated:March 24, 2025
- 2 minute read
- DataDirect Connectors
- JDBC
- Autonomous REST Connector 6.0
- Documentation
Typically, POST requests must pass a payload in the body element of the request; however, for certain services, there are endpoints that require POST requests to pass empty body elements to return results. For these endpoints, raw data is returned in the response of the request, instead of data that is dictated by parameters specified in the payload.
You can configure the driver to send POST request with an empty body by setting the
omitWhenEmpty
parameter to false
in the POST body. In
addition, you must set the media type for the response in the content-type
header and, if the authentication information is different than the default for your REST
model, authentication information for the endpoint (See "Custom authentication requests" for
details).
Note that if you do not set the omitWhenEmpty
parameter to
false
or set it true
(default), the driver returns an
error if the body is empty on a POST request. Conversely, if your POST request body includes
a payload, the driver will ignore the setting of omitWhenEmpty
parameter
and issue a request with the contents of the body.
An entry for a POST request with an empty body takes the following form:
"<table_name>": {
"#path": "<host_name>/<endpoint_path>",
"#post": {
"#omitWhenEmpty": false"
},
"#headers": {
"content-type": "<content_type>"
}
},
- table_name
- is the name of the relational table to which the driver maps the endpoint. For example, countries.
- host_name
- (optional) is the protocol and host name components of the URL endpoint. For example, http://example.com. You can omit this value by specifying the host name using the ServerName property.
- endpoint_path
- is the path component of the URL endpoint. For example,
country
. This can be an unparameterized or parameterized path, a path that uses query parameters, or an array of paths. See "Query paths" for examples and more information. - content_type
- is the media type used in the request and response.
For example, the following demonstrates an entry for a POST request with an empty body.
"countries": {
"#path": "http://example.com/country/",
"#post": {
"#omitWhenEmpty": false
},
"#headers": {
"content-type": "application/json"
}
},