Forum Discussion
How to change persist value (in F5 LB) to "None" using rest api
Using rest api I am able to change default persistence profile from None to dest_addr / source_addr. But I am not able to change it back to "None" (using rest API) from dest_addr / source_addr.
"persist":[{"name":"dest_addr","partition":"Common","tmDefault":"yes"}]
what should be the value for name when I want to change it to "None"?
Regards, Rudra
- uni_87886
Cirrostratus
Could you show the entire request? It should be just
"persist":"none"
- Rudra_Mahapatra
Nimbostratus
Thanks Uni for responding...
I am using HPE OO rest API PUT operation. I have specified {"persist":"none"} in body of request. And I am getting following error --> {"code":404,"message":"01020036:3: The requested persist profile (none) was not found.","errorStack":[]}
As mentioned earlier, it works fine when I provide {"persist":"dest_addr"} or {"persist":"source_addr"}
Regards,
- uni
Altostratus
Could you show the entire request? It should be just
"persist":"none"
- Rudra_Mahapatra
Nimbostratus
Thanks Uni for responding...
I am using HPE OO rest API PUT operation. I have specified {"persist":"none"} in body of request. And I am getting following error --> {"code":404,"message":"01020036:3: The requested persist profile (none) was not found.","errorStack":[]}
As mentioned earlier, it works fine when I provide {"persist":"dest_addr"} or {"persist":"source_addr"}
Regards,
- Satoshi_Toyosa1Ret. Employee
Use
(without quotation) ornull
(means empty object). Also, use{}
for modification. For example (using curl),PATCH
Check the current persistence configuration of the virtual
(withVS-HTTP
).dest_addr
curl -sku user:pass https:///mgmt/tm/ltm/virtual/VS-HTTP?\$select=persist
Output as below:
{ persist: [ { name: 'dest_addr', partition: 'Common', tmDefault: 'yes', nameReference: { link: 'https://localhost/mgmt/tm/ltm/persistence/dest-addr/~Common~dest_addr?ver=12.1.2' } } ] }
Change it to "none".
curl -sku user:pass https:///mgmt/tm/ltm/virtual/VS-HTTP \ -H "Content-Type: application/json" \ -X PATCH -d '{"persist":{}}'
Now check it again using the GET request. The output should show:
{}
See also "About null values and properties" section of iControl® REST API User Guide, Version 12.1.0, p. 18.
- webguy96
Nimbostratus
I would agree the behavior on this seems to not follow some other API calls, however, the code below should work if you don't mind seeing it in PowerShell.
$link = "https://${bigip}/ltm/virtual/~${partition}~${vs}" $hash = @{} $hash.Add("name", ${vs}) $hash.Add("partition", ${partition}) $hash.Add("tmDefault", "yes") $hash.Add("persist", $null)
$json = $hash | ConvertTo-Json
Invoke-RestMethod -Method Patch -Uri ${link} -Credential ${cred} -Body ${json} -ContentType 'application/json' -ErrorAction Stop
Recent Discussions
Related Content
* 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