Troubleshooting the REST API server

Several troubleshooting techniques, tools, and resources are available for resolving problems that you encounter with the HCL OneDB™ REST API.

Problem Solution
How can I find version information for the REST API? You can find the version of your REST API jar file by running
java -jar onedb-rest.jar -version
For example:
> java -jar onedb-rest-2.0.0.0.jar -version
OneDB REST Client 2.0.0.0
How can I find the full build information for the REST API? You can find the build information for your REST API jar file by running
java -jar onedb-rest.jar -buildInformation
For example:
> java -jar onedb-rest-2.0.0.0.jar -buildInformation
Product-Name: OneDB REST Client
Build-Version: 2.0.0.0
Build-Number: 305
Build-Date: 2021-04-23T11:41:35-0500
Commit: v2.0.0.0
How can I enable debug logging in the REST API server? You can customize the logging level of the REST API server by creating your own logback.xml file. This logback.xml file can either be in the current directory or in the classpath when you start the REST API server. For more information on logging options, see Logging in the REST API server.

An example logback.xml file that turns on DEBUG logging to a file named onedb-rest.log is found below.

<configuration scan="true" scanPeriod="5 seconds">

    <!-- This appender section produces the typical onedb-rest.log file -->
    <!-- See https://logback.qos.ch/manual/layouts.html#ClassicPatternLayout for details -->
    <appender name="FILE" class="ch.qos.logback.core.FileAppender">
        <append>true</append>
        <file>onedb-rest.log</file>
        <encoder>
            <pattern>%d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n
            </pattern>
        </encoder>
    </appender>

    <!-- The base logging level is set here -->
    <!-- You can choose from (TRACE, DEBUG, INFO, WARN, ERROR) -->
        <root level="DEBUG">
            <appender-ref ref="FILE" />
        </root>
                                        
        <!-- You can configure custom logging levels (TRACE, DEBUG, INFO, WARN,
            ERROR) for any java package name -->
        <!--<logger name="com.onedb.rest.api" level="DEBUG" />-->
        <!--<logger name="com.onedb.rest.sql" level="DEBUG" />-->
        <!--<logger name="com.informix.jdbc" level="INFO" />-->
        <!--<logger name="com.zaxxer.hikari" level="INFO" />-->
</configuration>
Why is it that the first time I run a REST query (or any HTTP POST) it works, but the second time, I get an HTTP 403 FORBIDDEN response?

This will happen if you have Anti Cross-Site Request Forgery tokens enabled, but your REST HTTP POST, PUT, or DELETE requests do not include the X-CSRF-TOKEN header.

On your first HTTP request, you will be authenticated against the database server. A session will be created for you in the REST server and the first HTTP response you receive will include a Set-Cookie directive with your session identifier. The first HTTP response will also include an X-CSRF-TOKEN in the header. Any subsequent HTTP POST, PUT, or DELETE requests that include your session cookie – and many HTTP clients will do the work of adding it for you automatically – must also include your X-CSRF-TOKEN token in the header of the request. If you send an HTTP request with a valid session cookie but with a missing or invalid X-CSRF-TOKEN, the HTTP response will be 403 FORBIDDEN.

See Enabling Anti Cross-Site Request Forgery tokens for more information.