Fortinet black logo

Administration Guide

Troubleshooting REST API

Copy Link
Copy Doc ID 825689eb-200d-11e9-b6f6-f8bc1258b856:170992
Download PDF

Test from Linux

Use your browser or another REST tool to test querying, deleting or updating using REST API. Below are some sample commands.

curl -k -i -u <uname>:<passwd> -H "Accept: application/xml" -X GET https://<servername>:8443/api

curl -k -i -u <uname>:<passwd> -H "Accept: application/xml" -X GET https://<servername>:8443/api/host

curl -k -i -u <uname>:<passwd> -H "Accept: application/xml" -X GET https://<servername>:8443/api/host/320

curl -k -i -u <uname>:<passwd> -H "Accept: application/xml" -X DELETE https://<servername>:8443/api/host/320

curl -k -i -u <uname>:<passwd> -H "Accept: application/xml" -X POST -d "mac=00:00:1D:33:44:55" -d "os=Windows" https://<servername>:8443/api/host/update

Enable debug

To enable debug, uncomment the following in the jersey servlet configuration in
/bsc/campusMgr/ui/ROOT/WEB-INF/web.xml:

<!--

<init-param>

<param-name>com.sun.jersey.config.feature.Trace</param-name>

<param-value>true</param-value>

</init-param>

<init-param>

<param-name>com.sun.jersey.spi.container.ContainerRequestFilters</param-name>

<param-value>com.sun.jersey.api.container.filter.LoggingFilter</param-value>

</init-param>

<init-param>

<param-name>com.sun.jersey.spi.container.ContainerResponseFilters</param-name>

<param-value>com.sun.jersey.api.container.filter.LoggingFilter</param-value>

</init-param>

-->

To restart tomcat-admin, run service tomcat-admin restart.

The debug file can be found in /bsc/logs/tomcat-admin/catalina.out.

Test from Linux

Use your browser or another REST tool to test querying, deleting or updating using REST API. Below are some sample commands.

curl -k -i -u <uname>:<passwd> -H "Accept: application/xml" -X GET https://<servername>:8443/api

curl -k -i -u <uname>:<passwd> -H "Accept: application/xml" -X GET https://<servername>:8443/api/host

curl -k -i -u <uname>:<passwd> -H "Accept: application/xml" -X GET https://<servername>:8443/api/host/320

curl -k -i -u <uname>:<passwd> -H "Accept: application/xml" -X DELETE https://<servername>:8443/api/host/320

curl -k -i -u <uname>:<passwd> -H "Accept: application/xml" -X POST -d "mac=00:00:1D:33:44:55" -d "os=Windows" https://<servername>:8443/api/host/update

Enable debug

To enable debug, uncomment the following in the jersey servlet configuration in
/bsc/campusMgr/ui/ROOT/WEB-INF/web.xml:

<!--

<init-param>

<param-name>com.sun.jersey.config.feature.Trace</param-name>

<param-value>true</param-value>

</init-param>

<init-param>

<param-name>com.sun.jersey.spi.container.ContainerRequestFilters</param-name>

<param-value>com.sun.jersey.api.container.filter.LoggingFilter</param-value>

</init-param>

<init-param>

<param-name>com.sun.jersey.spi.container.ContainerResponseFilters</param-name>

<param-value>com.sun.jersey.api.container.filter.LoggingFilter</param-value>

</init-param>

-->

To restart tomcat-admin, run service tomcat-admin restart.

The debug file can be found in /bsc/logs/tomcat-admin/catalina.out.