Troubleshooting Tip: How to resolve API error 'option empty or invalid, argc(0)'
| Description | This article describes how to resolve the error 'option empty or invalid, argc(0)' when restoring FortiManager configuration via the API. |
| Scope | FortiManager 7.6.0 and above. |
| Solution | The API can be used to save FortiManager configuration, and to restore it at a later point.
The following is an example that can be used to obtain FortiAnalyzer settings inside of a 'System Template':
{
"result": [ { "data": { "access-config": 1, "certificate": [], "certificate-verification": 0, "enc-algorithm": 0, "hmac-algorithm": 0, "ips-archive": 1, "max-log-rate": 0, "monitor-failure-retry-period": 5, "monitor-keepalive-period": 5, "oid": 5712, "preshared-key": null, "priority": 3, "reliable": 1, "ssl-min-proto-version": 0, "upload-option": 1, "vrf-select": 0 }, "status": { "code": 0, "message": "OK" }, "url": "/pm/config/adom/root/devprof/Test-System-Template/log/fortianalyzer/setting" } ],
When trying to restore this configuration using the previous information by using SET method, where 'enc-algorithm' equals 0, the following error will appear, since 0 is not an expected numeric value for 'enc-algorithm':
{ "result": [ { "status": { "code": -9001, "message": "log/fortianalyzer/setting/enc-algorithm : invalid value - prop[enc-algorithm]: option empty or invalid, argc(0)" }, "url": "/pm/config/adom/root/devprof/Test-System-Template/log/fortianalyzer/setting" } ], "id": 1 }
Values provided are referred by numbers instead of human-readable names. In order to obtain the parameters values, that can be used in the restoration, it is advised to use verbose:1 when saving configuration via API method GET:
{ "session": "{{fmg-session}}", "id": 1, "method": "get", "verbose": 1, <----- Verbose mode. "params": [ { "url": "/pm/config/adom/root/devprof/Test-System-Template/log/fortianalyzer/setting" } ] }
{ "result": [ { "data": { "access-config": "enable", "certificate": [], "certificate-verification": "disable", "enc-algorithm": null, "hmac-algorithm": "sha256", "ips-archive": "enable", "max-log-rate": 0, "monitor-failure-retry-period": 5, "monitor-keepalive-period": 5, "oid": 5712, "preshared-key": null, "priority": "default", "reliable": "enable", "ssl-min-proto-version": "default", "upload-option": "realtime", "vrf-select": 0 }, "status": { "message": "OK" }, "url": "/pm/config/adom/root/devprof/Test-System-Template/log/fortianalyzer/setting" } ], "id": 1 } |
