Forum Discussion
youssef1
Oct 17, 2018Cumulonimbus
Hello,
First of you have to generate your Authentication token using this command:
curl -k -X POST -H "Content-Type: application/json" -d '{"username":"restapiuser","password":"restapiuser","loginProviderName": "tmos"}' https://management-IP/mgmt/shared/authn/login
You will receive a json, which includes a token. we will use it later for all our other rest API call.
..............{"token":"2MBFDOIJEFEKJ97DSDSDDSETU"...............
node creation:
curl -k -X POST -H "Content-Type: application/json" -H "X-F5-Auth-Token:2MBFDOIJEFEKJ97DSDSDDSETU" -d '{"name":"","address":""}' https://management-IP/mgmt/tm/ltm/node
Monitor creation:
curl -k -X POST -H "Content-Type: application/json" -H "X-F5-Auth-Token:2MBFDOIJEFEKJ97DSDSDDSETU" -d '{"name":"my-monitor-api","send":"GET / HTTP/1.1\r\nHost: mymonitor.domain.com\r\nConnection: Close\r\n\r\n","recv":""}' https://management-ip/mgmt/tm/ltm/monitor/http
Pool Creation:
curl -k -X POST -H "Content-Type: application/json" -H "X-F5-Auth-Token:2MBFDOIJEFEKJ97DSDSDDSETU" -d '{"name":"my-pool-api","monitor":"/Common/my-monitor-api"}' https://management-IP/mgmt/tm/ltm/pool
For more information you have a good doc below:
https://support.f5.com/csp/article/K51731137p1
let me know if you need more details.
regards,