Forum Discussion

Mike_Rizzo_6112's avatar
Mike_Rizzo_6112
Icon for Nimbostratus rankNimbostratus
Jun 30, 2015

400 error when creating LTM monitor with iControlREST

Hello DevCentral community,

I'm getting started using iControl REST and I'm getting an unexpected error when I try to send a POST to create a new LTM monitor. Here is what I'm sending with curl:

curl -sk -u admin:secret https://bigip-lab-box.local/mgmt/tm/ltm/monitor/ -H 'Content-Type: application/json' -X POST -d '{"name":"testmonitor","defaultsFrom":"/Common/http","destination":"*:80","interval":"5","timeout":"16","send":"GET /up.txt","recv":"200"}'

From this, I receive the response:

{"code":400,"message":"Found unexpected json pair at module /ltm/monitor. The json pair is \"testmonitor\":null.","errorStack":[]}

I've tried adding a few additional properties such as "partition" and got the same error, so I've kept the example to the basics. As far as I can tell the JSON component is formatted correctly, and it contains values for all of the same options I would set when using tmsh from the command line.

I'm executing this against a Virtual Edition appliance running BigIP 11.5.3 (build 0.0.163).

If anybody has an idea where I'm going wrong, I'd very much appreciate the help!

1 Reply

  • nathe's avatar
    nathe
    Icon for Cirrocumulus rankCirrocumulus

    Mike,

    You need to go into the Sub-module to do this. Try:

    curl -sk -u admin:secret https://bigip-lab-box.local/mgmt/tm/ltm/monitor/http -H 'Content-Type: application/json' -X POST -d '{"name":"testmonitor","defaultsFrom":"/Common/http","destination":"*:80","interval":"5","timeout":"16","send":"GET /up.txt","recv":"200"}'

    Notice the http after ...ltm/monitor/

    This worked for me.

    Hope this helps,

    N