Question
Rest API error when creating a firewall policy on a Fortigate 5.4.6
Hello,
I'm trying to use the Fortigate REST API to add various objets on our 1500D. It works quite fine except for adding new firewall policies. The firewall throws a 405 error when posting (POST) a request on this API URL (/api/v2/cmdb/firewall/policy/?vdom=VDOMNAME)
Here are the details :
JSON request :
{
'action': 'accept',
'srcintf':[
{
'name':'IFNAME02',
}
],
'dstintf':[
{
'name':'IFNAME01',
}
],
'srcaddr':[
{
'name':'all',
}
],
'dstaddr':[
{
'name':'all',
}
],
'service':[
{
'name':'ALL',
}
],
'status':'enable',
'schedule':'always',
'nat':'disable',
'logtraffic':'utm',
}
And the error :
405 Method Not Allowed
{
"http_method": "POST",
"status": "error",
"http_status": 405,
"vdom": "VDOMNAME",
"path": "firewall",
"name": "policy",
"action": "accept",
"serial": "FG1K",
"version": "v5.4.6",
"build": 1165
}
If I remove the parameter "action" in my JSON data, the policy is created but with a default deny value, which is not what I want.
Any ideas ?
Regards.
