Forum Discussion

Glen_Pekarcsik's avatar
Glen_Pekarcsik
Icon for Nimbostratus rankNimbostratus
Jul 24, 2019

F5 API - Unexpected Argument on /mgm/tm/ltm/policy

I am getting the following error when trying to create a draft policy in LTM via the API

 

{

  "code": 400,

  "message": "\"policy\" unexpected argument",

  "errorStack": [],

  "apiError": 26214401

}

 

I am making a POST to https://{{big_ip_a_mgmt}}/mgmt/tm/ltm/policy. Here is the JSON Post Body I am using:

 

{

  "name": "asm_auto_l7_policy__testserver-443",

  "partition": "/Common/Drafts/",

  "controls": [

    "asm"

  ],

  

 "requires": [

    "http"

  ],

 

  "status": "legacy",

  "strategy": "/Common/first-match",

  "rules" : [

   {

  "name": "default",

  "fullPath": "default",

  "ordinal": 1,

  "actions" : [ {

  "name": "1",

  "fullPath": "1",

  "asm": true,

  "code": 0,

  "enable": true,

  "expirySecs": 0,

  "length": 0,

  "offset": 0,

  "policy": "/WebSeal/Test-Policy2",

  "port": 0,

  "request": true,

  "status": 0,

  "timeout": 0,

  "vlanId": 0

    }]}]

}

 

Any ideas on why I would be getting an HTTP 400? This was working a couple of weeks ago.

  • I took your request and only modified the referenced policy (changed to /Common/test for my lab) and it worked without issue, v13.1.0.3.

     

    It's strange that it believes "policy": "/WebSeal/Test-Policy2" to be an unexpected argument, if it truly was unexpected it would fail in my lab too.

     

    It's valid JSON too.

     

    {  
       "name":"asm_auto_l7_policy__testserver-443",
       "partition":"/Common/Drafts/",
       "controls":[  
          "asm"
       ],
       "requires":[  
          "http"
       ],
       "status":"legacy",
       "strategy":"/Common/first-match",
       "rules":[  
          {  
             "name":"default",
             "fullPath":"default",
             "ordinal":1,
             "actions":[  
                {  
                   "name":"1",
                   "fullPath":"1",
                   "asm":true,
                   "code":0,
                   "enable":true,
                   "expirySecs":0,
                   "length":0,
                   "offset":0,
                   "policy":"/WebSeal/Test-Policy2",
                   "port":0,
                   "request":true,
                   "status":0,
                   "timeout":0,
                   "vlanId":0
                }
             ]
          }
       ]
    }

     

  • You can try watching the following log outputs on the F5 via SSH while sending your request to see if any errors occur:

    # tailf /var/log/restjavad.0.log

    # tailf /var/log/restnoded/restnoded.log

    # tailf /var/log/ltm