Problem when trying to move simple queues

Good afternoon everyone, I am trying to move a queue to first position through php api, but sometimes the script removes all queues rather than move it, someone could give me a hand with this script? routeros version routeros 5.2x
very grateful to all!

$API->write(‘/queue/simple/getall’, false);
$API->write(‘?name=’ . $name);
$ARRAY = $API->read();
$ARRAY = $ARRAY[0];
$API->write(‘/queue/simple/move’, false);
$API->write(‘=.id=’ . $ARRAY[‘.id’],false);
$API->write(‘=destination=*0’,true);
$ARRAY = $API->read();
$API->disconnect();

The ID of the first item probably isn’t “*0”. That is, you’d need to take that out of the print too. In the “/queue/simple” menu in particular, you can also target by name BTW.

A move command should never be removing anything though.

Thank you friend, you could help me with this problem, I need to move a queue to the top, how would the script below?

$API->write('/queue/simple/getall', false);
$API->write('?name=' . $name);
$ARRAY = $API->read();
$ARRAY = $ARRAY[0];
$API->write('/queue/simple/move', false);
$API->write('=.id=' . $ARRAY['.id'],false);
$API->write('=destination=*0',true);
$ARRAY = $API->read();
$API->disconnect();

If you don’t know the name of the first queue in advance, you need to get it with a print.

After you have that, you just supply it as the “destination” argument.

In terms of actual code… I feel really awkward working with that client, especially when with mine, it’s simplified to

$util->changeMenu('/queue/simple');
$util->move($name, 0);

(see this for a full code sample)


I guess with that, it would something among the lines of

$API->write('/queue/simple/getall', false);
$ARRAY = $API->read();
$ARRAY = $ARRAY[0];
$API->write('/queue/simple/move', false);
$API->write('=.id=' . $name,false);
$API->write('=destination=' . $ARRAY['.id'],true);
$ARRAY = $API->read();
$API->disconnect();