RouterOs Api Script

Hi,
In the following figure, the script I wrote via routeros api gives an error. What’s the right way?

$API->write('/ip/hotspot/cookie/remove');
$API->write('=user=155548745');
$OKU=$API->read(false);
$ARRAY = $API->parseResponse($OKU);
print_r ($ARRAY);

Error Code :
[code][!trap] => Array ( [0] => Array ( [message] => no such command prefix ) )

Thanks…

Try remove by id not by name.
In terminal of WinBox

/ip hotspot cookie remove ?

I see

Remove specified item (or several items).
– List of item numbers

i.e. very probably it needs numbers i.e. I think ids, something like

$API->write('=.id=*ABCDEF');

Sure you need find value of field “.id” for required user first…
In terminal it is command like:

:put [/ip hotspot cookie find user="155548745"]

Or try condition:

$API->write('?=user=155548745');

From API docs unclear if this work in such way

Thanks…