Edit profile user hotspot via api + php

Hello everyone!
I’m trying to edit a hotspot via User profile api
and I can not
the lower the php script that does not work could someone help me?
Thank you for your attention
$nome = ‘profile 150k’;

$API->write(‘/ip/hotspot/user/profile/getall’, false);
$API->write(‘?nome=’ . $nome);
$ARRAY = $API->read();
$ARRAY = $ARRAY[0];
$API->write(‘/ip/hotspot/user/profile/set’, false);
$API->write(‘=.id=’.$ARRAY[‘.id’]);
$API->write(‘=rate-limit=150k/150k’, true);
$ARRAY = $API->read();
$API->disconnect();

I haven’t tried the rest, but these looks incorrect.
I think this needs a “done with commands” true at the end. Like

$API->write(‘?name=’ . $nome, true);

I think the .id would not be a valid index for this array.

$API->write(‘=.id=’.$ARRAY[‘.id’]);