Twilio - 找不到请求的资源错误。在子账户之间转移号码时

Twilio - The requested resource not found error. while transferring number between sub accounts

我正在使用此示例代码将号码从一个子账户转移到另一个子账户。 (https://www.twilio.com/docs/api/rest/subaccounts)

// Your Account Sid and Auth Token from twilio.com/user/account
$sid = "ACmastersid"; 
$token = "mastertoken"; 
$client = new Services_Twilio($sid, $token);

// Get an object from its sid. If you do not have a sid,
// check out the list resource examples on this page
$number = $client->account->incoming_phone_numbers-  >get("PN2xxxxxxxxxxxxxxxx");
$number->update(array(
    "AccountSid" => "AC00000000000000000000000000000002"
));
echo $number->phone_number;

我收到这个错误:

请求的资源 /2010-04-01/Accounts/ACxxxxxxxx/IncomingPhoneNumbers/PNxxxxxxxxxxx.json 未找到

不清楚代码有什么问题。

感谢任何帮助。

谢谢。

以下代码工作正常。您需要从要移动的帐户中获取 phone 数字对象,然后更新帐户 sid。

// Your Account Sid and Auth Token from twilio.com/user/account
$sid = "ACmastersid"; 
$token = "mastertoken"; 
$client = new Services_Twilio($sid, $token);

$account = $client->accounts->get( "AC00000000000000000000000000000001");
$number = $account->incoming_phone_numbers->get($phonesid);
$number->update(array(
"AccountSid" => "AC00000000000000000000000000000002"));
echo $number->phone_number;