How to use the WidgetOptions Api Call


I am trying to use the widgetOptions api call to specifically target the ‘align’ feature for an image. How do I use it? I can’t seem to alter the value. I have been able to change the duration parameter and the useDuration but that is about all I could change. I am using python to send a put request by the way. I am sure it is because of how i am trying to call it. Any help will be appreciated thanks :slight_smile:

EDIT: This is currently how I am trying to access it. Still cannot target the align feature of this call.

data = {‘widgetId’:2107,‘duration’:43,‘useDuration’:1,‘widgetOptions[0][widgetId]’:2107,‘widgetOptions[0][type]’:‘attrib’,‘widgetOptions[0][option]’:‘align’,‘widgetOptions[0][value]’:‘right’};

response = requests.put(url ,headers,data = data);

Apologies for the delay, we had a long weekend here in UK.

To change the vertical or horizontal alignment of an image, you would need to call

with alignId (left, center, right) and valignId (top, middle, bottom) parameters.

For example, say my image widget has widgetId 1082 and I want to adjust alignment to be Top and Right, then I’d do something like this:

the x-www-form-urlencoded header is also very important in all edit (PUT) calls.

I hope that helps.

If you’re using 2.0 or 2.1 CMS, then make sure your layout is in draft state and that you’re passing the widgetId that exists on the draft.

1 Like