Forum Discussion

RAHUL_AM88_3527's avatar
RAHUL_AM88_3527
Icon for Nimbostratus rankNimbostratus
Apr 05, 2018

Create snat failed using rest api

Resquest - $1 payload-

{
    "items": [
        {
            "name": "Test",
            "partition": "Common",
            "fullPath": "/Common/Test",
            "autoLasthop": "enabled",
            "mirror": "disabled",
            "sourcePort": "preserve",
            "translation": "/Common/192.168.1.3",
            "vlansEnabled": true,
            "vlans": [
                "/Common/vlan.outside"
            ],
            "origins": [
                {
                    "name": "0.0.0.0/0"
                }
            ]
        }
    ]
}

Response - { "code": 403, "message": "Operation is not supported on component /ltm/snat.", "errorStack": [], "apiError": 1 }

6 Replies

  • I believe this seems to do what you are asking.

     

     

    curl -sku admin:admin https://192.168.10.23/mgmt/tm/ltm/snat -H "content-type:application/json"  -d '{
          "name": "test2",
          "partition": "Common",
          "autoLasthop": "enabled",
          "mirror": "disabled",
          "sourcePort": "preserve",
          "translation": "/Common/192.168.1.3",
          "vlansEnabled": true,
          "vlans": [
            "/Common/EXTERNAL"
          ],
          "origins": [
            {
              "name": "::/0"
            },
            {
              "name": "0.0.0.0/0"
            }
          ]
        }'
    

     

  • Thank you

     

    This works from F5 directly. But, I am trying to do the exact command from Windows with Curl it doesn't understand the JSON format.

     

    Do you have any reference on how I can add a loop statement or custom script with F5? I need to create about 500+ SNAT entries.

     

    • Patrik_Jonsson's avatar
      Patrik_Jonsson
      Icon for MVP rankMVP

      Sure, I can help you. But then please create your own question so you have the ability to mark as the right answer.