Python API queues place-before

i’m looking to place new simple queue items after the first rule.

Mikrotik CLI works fine.
/queue simple> add name=“TEST” target=192.168.1.66/32 parent=none queue=UnlimUp/UnlimDown comment=“test” place-before=“1”

Python code works fine until I add place-before

Python code throws keyword can’t be an expression syntax error.

 
api = connection.get_api()
list_queues = api.get_resource('/queue/simple')
list_queues.add(queue="UnlimUp/UnlimDown", target=ipaddress, place-before=1, comment="daily")

Is there any means of achieving this? thanks.

What is “1”?
1 is a number, is not .id value, like *8f
You must obtain first the .id of the first queue ([find]->0) and use that value.

No matter if the queue is the first, the 10th or the last, the .id of the queue are not sorted and can have holes.

example:

.id=*2;;limit-at=0/0;max-limit=0/0;name=queue1;packet-marks=;parent=none;priority=8/8;queue=default-small/default-small;target=
.id=*c;;limit-at=0/0;max-limit=0/0;name=queue2;packet-marks=;parent=none;priority=8/8;queue=default-small/default-small;target=
.id=*3;;limit-at=0/0;max-limit=0/0;name=queue3;packet-marks=;parent=none;priority=8/8;queue=default-small/default-small;target=
.id=*7;;limit-at=0/0;max-limit=0/0;name=queue4;packet-marks=;parent=none;priority=8/8;queue=default-small/default-small;target=
.id=*5;;limit-at=0/0;max-limit=0/0;name=queue5;packet-marks=;parent=none;priority=8/8;queue=default-small/default-small;target=
.id=*6;;limit-at=0/0;max-limit=0/0;name=queue6;packet-marks=;parent=none;priority=8/8;queue=default-small/default-small;target=
.id=*a;;limit-at=0/0;max-limit=0/0;name=queue7;packet-marks=;parent=none;priority=8/8;queue=default-small/default-small;target=
.id=*8;;limit-at=0/0;max-limit=0/0;name=queue8;packet-marks=;parent=none;priority=8/8;queue=default-small/default-small;target=
.id=*9;;limit-at=0/0;max-limit=0/0;name=queue9;packet-marks=;parent=none;priority=8/8;queue=default-small/default-small;target=

Thanks for the response.

Reading the API notes https://pypi.org/project/RouterOS-api/ I’d missed the note about using underscores.
NOTE: Attributes with -, like max-limit use underscore _: max_limit

Following works OK.

list_queues.add(queue="UnlimUp/UnlimDown", target=ipaddress, place_before=1, comment="daily")

I could not get ([find]->0) to work I’m afraid.