Hot!JSON REST API lack of documentation on errors

Author
rgagnon
New Member
  • Total Posts : 2
  • Scores: 0
  • Reward points: 0
  • Joined: 2019/10/10 09:01:41
  • Status: offline
2019/10/10 09:10:02 (permalink)
0

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.
#1
emnoc
Expert Member
  • Total Posts : 5469
  • Scores: 357
  • Reward points: 0
  • Joined: 2008/03/20 13:30:33
  • Location: AUSTIN TX AREA
  • Status: offline
Re: JSON REST API lack of documentation on errors 2019/10/10 15:55:40 (permalink)
0
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  
#2
rgagnon
New Member
  • Total Posts : 2
  • Scores: 0
  • Reward points: 0
  • Joined: 2019/10/10 09:01:41
  • Status: offline
Re: JSON REST API lack of documentation on errors 2019/10/11 06:29:46 (permalink)
0
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.
#3
emnoc
Expert Member
  • Total Posts : 5469
  • Scores: 357
  • Reward points: 0
  • Joined: 2008/03/20 13:30:33
  • Location: AUSTIN TX AREA
  • Status: offline
Re: JSON REST API lack of documentation on errors 2019/10/11 08:01:25 (permalink)
0
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
post edited by emnoc - 2019/10/11 08:20:50

PCNSE 
NSE 
StrongSwan  
#4
Jump to:
© 2020 APG vNext Commercial Version 5.5