Showing results for 
Search instead for 
Did you mean: 

"POST on list must be on list element" error message

Cisco Employee
Cisco Employee

Hello Team, I was wanting to create guest SSID using RESTCONF interface on Cisco WLC 9800 Controller. I made use of yangsuite module that generates REST API and wrote a python script and the error message which I see upon execution (both attached). 

Any thoughts why would it throw out that error when I clearly have list of dictionaries in the payload. TIA


1 Reply 1

Alex Stevenson
Cisco Employee
Cisco Employee


Hello @dcasteli,


The images are really helpful but it would be even better if you could paste the Python code in here for us to debug using the code tab ( </> ) above. I have a Python linter extension on VS Code, so I normally paste any code with malformed bugs into there and it will highlight the syntax errors right away.


Let's break down this payload:


- the payload itself is a dictionary { }

- the payload dictionary has 9 main elements

- the first element in the dictionary has a list as its value and this list contains one dictionary with two sub-elements of its own.


As such,


payload["apf-vap-id-data"][0]["ssid"] = "guest-restconf"

payload["apf-vap-id-data"][0]["wlan-status"] = "True"


- (I believe you could technically remove the comma on line 17 also).

- So you see, there is not a 'list of dictionaries' but one list with two elements that serves as the value of the first element in the payload dictionary.


In order to work with a list, which the error is calling for, I think you would either need to call on the specific element which is a list, in your request:






Place the brackets ( [ ] ) around everything in your payload and add some braces, making it a list of dictionaries:  payload = { [ ] }


It gets tricky because you are not using RESTCONF or the other methods directly, as  the guides describe:

Catalyst 9800 Programmability and Telemetry Deployment Guide

Cisco Catalyst 9800 Series Wireless Controller Programmability Guide


So, it's hard for me to say what the REST API you generated with YANG Suite is calling for. 


Hope this helps!

Getting Started

Find answers to your questions by entering keywords or phrases in the Search bar above. New here? Use these resources to familiarize yourself with the community:

Recognize Your Peers