Forum Discussion

Zdenda's avatar
Zdenda
Icon for Cirrus rankCirrus
Jun 28, 2018

API rest update profile on VS - strange result

Hi, do you update any profile on VS via API? I do attach profiles during creating VS (so using POST), that's easy. But updating profile seems bit tricky.

Looks like, that even I use PATCH, I have to list also some other existing profiles in the payload, so similar behavior as using PUT.

First test, just using profile I want to add (output from my python code, but shows the point):

 

payload = {'profiles': [{'name': 'l7dos'}]}
self.rest.patch('/ltm/virtual/~Common~vsTesthttp', payload)

 

result: 

Result: 400 PATCH, {u'errorStack': [], u'message': u'01071782:3: Virtual server (/Common/vsTesthttp): DoS profile with Application Security enabled requires HTTP profile.'

Second test including http profile in the payload:

 

payload = {'profiles': [{'name': 'l7dos'}, {'name': 'http'}]}
self.rest.patch('/ltm/virtual/~Common~vsTesthttp', payload)

 

result: 

Result: 200 PATCH

The virtual server has http profile all the time, so why I have to specify it when using PATCH? Is it maybe because virtual server profiles are not really sorted by its type, so we cannot use patch just with payload of the profile I want to modify?

4 Replies

  • When you don't specify the http profile, even with a patch, it assumes the value is NONE and tries to patch that as well. It is odd, but I assume it is tied to the way the objects are linked in the config.

     

  • When you don't specify the http profile, even with a patch, it assumes the value is NONE and tries to patch that as well. It is odd, but I assume it is tied to the way the objects are linked in the config.