For more information regarding the security incident at F5, the actions we are taking to address it, and our ongoing efforts to protect our customers, click here.

Forum Discussion

NetworkingSometimes's avatar
Mar 30, 2022
Solved

Create iRule REST error: Found invalid JSON body in the request

Greetings, I saw a few other forums posts about the same error but I was not able to figure out what is wrong with the command below: curl -sku admin:admin -H "Content-Type: application/json" -X PO...
  • JRahm's avatar
    Mar 30, 2022

    I posted your curl command in as is (except for the BIG-IP hostname swap) and it worked just fine:

    jrahm % curl -sku admin:admin -H "Content-Type: application/json" -X POST https://ltm3.test.local/mgmt/tm/ltm/rule -d '{"name":"f5RESTSampleRule", "apiAnonymous":"when CLIENT_ACCEPTED {\n node 172.28.0.41 \n}" }'
    
    {"kind":"tm:ltm:rule:rulestate","name":"f5RESTSampleRule","partition":"Common","fullPath":"/Common/f5RESTSampleRule","generation":1585,"selfLink":"https://localhost/mgmt/tm/ltm/rule/~Common~f5RESTSampleRule?ver=15.1.2.1","apiAnonymous":"when CLIENT_ACCEPTED {\n node 172.28.0.41 \n}"}

    Could be mangled smartquotes or something? Try copying from vs code or vi and not any text editor that "helps" with formatting. 🙂