Forum Discussion
S__233_bastien2
Nimbostratus
Jul 06, 2017Update/modify an iApp instance with iControlREST
Hi, I've build an iApp, and I would like to create/update services using iControl REST.
Creation is working fine:
↪ curl -sk -u admin:password -H "Content-Type: application/json" -X POST --data @iapp.json https://172.31.X.X/mgmt/tm/sys/application/service/ | jq .
{
"kind": "tm:sys:application:service:servicestate",
"name": "test",
"partition": "Common",
"subPath": "test.app",
"fullPath": "/Common/test.app/test",
"generation": 1120,
"selfLink": "https://localhost/mgmt/tm/sys/application/service/~Common~test.app~test?ver=13.0.0",
"deviceGroup": "none",
"inheritedDevicegroup": "false",
"inheritedTrafficGroup": "false",
"strictUpdates": "enabled",
"template": "/Common/mytemplate",
"templateReference": {
"link": "https://localhost/mgmt/tm/sys/application/template/~Common~mytemplate?ver=13.0.0"
},
"templateModified": "no",
"trafficGroup": "none",
"tables": [
{
"name": "hosts__ip_host",
"columnNames": [
"ip",
"host"
],
"rows": [ ..... ]
}
],
"variables": [
{
"name": "vip__vip",
"encrypted": "no",
"value": "2.2.2.2"
}
]
}
`
Update is not easy :
`↪ curl -sk -u admin:password -H "Content-Type: application/json" -X POST --data @iapp.json https://172.31.X.X/mgmt/tm/sys/application/service/
{"code":400,"message":"01020066:3: The requested application instance (/Common/test.app/test) already exists in partition Common.","errorStack":[],"apiError":3}
↪ curl -sk -u admin:password -H "Content-Type: application/json" -X PUT --data @iapp.json https://172.31.X.X/mgmt/tm/sys/application/service/
{"code":403,"message":"Operation is not supported on component /sys/application/service.","errorStack":[],"apiError":1}
Do you see where I'm wrong ?
Do you know how to use the "Reconfigure" action that I use to have in WebUI?
Thank you in advance,
Best regards,
- Sébastien B.
- Satoshi_Toyosa1Ret. Employee
Use the
method to modify the field(s).PATCH
Check the
field in the output you got when you created the iApp. That's where the endpoint (URL) is. In your case, that'sselfLink
"selfLink": "https://localhost/mgmt/tm/sys/application/service/~Common~test.app~test?ver=13.0.0",
For example,
Create an iApp (TestApp):
curl -sku admin: https:///mgmt/tm/sys/application/service \ -H "Content-Type: application/json" \ -X POST -d@iAppMakeDel.dat
The output says:
{ ... "fullPath":"/Common/TestApp.app/TestApp", "selfLink":"https://localhost/mgmt/tm/sys/application/service/~Common~TestApp.app~TestApp?ver=11.6.1", ... }
Get the iApp (equivalent to
😞tmsh list sys application service TestApp.app/TestApp
curl -sku admin: \ https:///mgmt/tm/sys/application/service/~Common~TestApp.app~TestApp
Modify the Description field:
curl -D - -sku admin: \ https:///mgmt/tm/sys/application/service/~Common~TestApp.app~TestApp \ -X PATCH -H "Content-Type: application/json" \ -d '{"description":"Hello World"}'
Recent Discussions
Related Content
DevCentral Quicklinks
* Getting Started on DevCentral
* Community Guidelines
* Community Terms of Use / EULA
* Community Ranking Explained
* Community Resources
* Contact the DevCentral Team
* Update MFA on account.f5.com
Discover DevCentral Connects