Support Forum
The Forums are a place to find answers on a range of Fortinet products from peers and product experts.
rgagnon
New Contributor

JSON REST API lack of documentation on errors

Is there a reference somewhere to the error codes that the REST API responds with?

 

I am testing an API client we've built and I'd like to translate the negative integer values into something a little more meaningful, but there seems to be no documentation on errors other than the general HTTP status code 200, 404, 500, etc...

 

For example, if I create a new address group via API, but then try to create the same group name again, I get the following response:

 

HTTP/1.1 500 Internal Server Error

...other headers...

 

BODY contains:

{   "http_method":"POST",   "revision":"c6ccf9fedb18ed33a43ee240a078b94c",   "error":-5,   "status":"error",   "http_status":500,   "vdom":"root",   "path":"firewall",   "name":"addrgrp",   "serial":"FGTXXXXXXXXXXXXX",   "version":"v6.2.1",   "build":932 }

 

Here, I can only assume that the "-5" for "error" means duplicate entry exists, but there are other possible values we'd like to know what went wrong other than "-2" or something like it.

3 REPLIES 3
emnoc
Esteemed Contributor III

Good question. I think you need to ask support or run debug to gather more details.

e.g

diag debug app httpsd -1

 

Ken Felix

PCNSE 

NSE 

StrongSwan  

PCNSE NSE StrongSwan
rgagnon
New Contributor

Debug won't help really.

 

In order to properly develop a client, you need to know the error codes you COULD get.  Not reverse engineer them when they happen.

 

This is because you would not know all the possible situations or errors that could happen.  Imagine if the RFC for HTTP never published what "404" meant?  People would just have to guess that it was "not found", and then wonder what a 403 means if it was rare.  This is why they publish a document with all possible errors, and their meanings.

 

I would think FortiGate has something somewhere with this information.

emnoc
Esteemed Contributor III

Contact support and request the API reference, status and error codes. I 've never seen it published but the material that I have is approx 3 years old.

 

Also start at the FDN, link

https://www.fortinet.com/products/management/fortinet-developer-network-fndn.html

 

Ken Felix

PCNSE 

NSE 

StrongSwan  

PCNSE NSE StrongSwan
Labels
Top Kudoed Authors