Forum Discussion

geeko_85254's avatar
geeko_85254
Icon for Altostratus rankAltostratus
Jun 01, 2017

iControl Rest rewrite profile

I am trying to convert the following tmsh command to iControl Rest.

 

tmsh modify ltm profile rewrite test uri-rules add { test_rule {client { host test.com path /test/ scheme http } server { host 10.2.2.2 path / scheme http}}}

 

Here is my attempt to do so and the result.

 

$ curl -k -u icontrol -X POST -H "Content-type: application/json" -d ‘{"client":{"host":"test.com","path":"/test/","scheme":"http"},"server":{"host":"10.2.2.2","path":"/","scheme":"http"},"type":"both"}’

 

Enter host password for user 'icontrol':

 

curl: (6) Could not resolve host: ‘client:path

 

curl: (3) Illegal port number

 

curl: (6) Could not resolve host: ‘server:host

 

curl: (6) Could not resolve host: ‘server:path

 

curl: (3) Illegal port number

 

curl: (3) Illegal port number

 

{"code":400,"message":"Found invalid JSON body in the request.","errorStack":[],"apiError":1}

 

Any help would be much appreciated!

 

  • Hello, I think you forgot the rule name on the request, try this way:

    curl -k -u icontrol -X POST -H "Content-type: application/json" -d ‘{"client":{"host":"test.com","path":"/test/","scheme":"http"},"server":{"host":"10.2.2.2","path":"/","scheme":"http"},"type":"both"}’ https://bigip/mgmt/tm/ltm/profile/rewrite/test/uri-rules/test_rule
    

    Regards.