Forum Discussion

Radu_Faragau_18's avatar
Radu_Faragau_18
Icon for Nimbostratus rankNimbostratus
Feb 26, 2015

Assign iRule to Virtual Server via iControl REST

Hi guys,

 

I am trying to create a Virtual Server using iControl REST API but I have problems specifying the iRule to be assigned to the server.

 

Here is the JSON content I am POST-ing:

 

{"name": "iControl_virtual", "rules": ["/Common/_sys_https_redirect"], "mask": "255.255.255.255", "nat64": "disabled", "destination": "192.168.1.30:80", "enabled": null, "sourceAddressTranslation": {"type": "automap"}, "source": "0.0.0.0/0", "profiles": [ {"kind": "ltm:virtual:profile", "name": "tcp"}, {"kind": "ltm:virtual:profile", "name": "http"} ], "mobileAppTunnel": "disabled", "mirror": "disabled", "ipProtocol": "tcp", "pool": "icontrol_pool", "description": "A Python REST client test virtual server"}

 

And the error returned by F5:

 

{"errorStack": ["java.net.ProtocolException: Status code:400, uri: body: {\"errorResponse\":\"{\\"error\\":{\\"code\\":400,\\"message\\":\\"\\\\"replace-all-with\\\\" unexpected argument\\"}}\",\"errorStack\":[]}"

 

I have the feeling I'm missing something here. Would appreciate any help.

 

F5 firmware: BIG-IP 11.4.1 Build 608.0 Final

 

Thanks, Radu

 

2 Replies

  • Perhaps you've missed something but shouldn't the URI be .../mgmt/tm/ltm/virtual/?

    I'd imagine you need braces around the rule name:

    [{"/Common/_sys_https_redirect"}]
    

    Alternatively, try adding a name parameter:

    [{"name": "/Common/_sys_https_redirect"}]
    
  • Thanks for your feedback,

     

    I have tried your suggestions but the same error is returned. The same message is returned: "replace-all-with\\\\" unexpected argument\\"

     

    Regards, Radu