首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场

PHP /PHP
EN

Stack Overflow用户
提问于 2018-05-22 14:27:21
回答 1查看 185关注 0票数 1

我正在使用RingCentral的API试图提取帐户中所有用户的存在状态(我们有30个用户)。我已经检查了RingCentral管理方面,并确保所有的手机都有他们的节目现场启用。我有下面的代码,这些代码正常工作,并且处于存在状态。然而,它只会吸引一个扩展。有没有人熟悉这个API,以及如何查询所有扩展?下面的代码:(就像我说的那样,这是完美的工作,只需拉动一个扩展(与我登录的那个)。

代码语言:javascript
运行
复制
require_once(__DIR__ . '/_bootstrap.php');
use RingCentral\SDK\SDK;

// Create SDK instance
$credentials = require(__DIR__ . '/_credentials.php');
$rcsdk = new SDK($credentials['clientId'], $credentials['clientSecret'], $credentials['server'], 'Demo', '1.0.0');
$platform = $rcsdk->platform();

// Authorize
$platform->login($credentials['username'], $credentials['extension'], $credentials['password']);

// Load extensions  //
$extensions = $platform->get('/account/~/extension', array('perPage' => 10))->json()->records;

// show user count here, only showing a count of 1
print 'Users loaded ' . count($extensions) . PHP_EOL;

$presences = $platform->get('/account/~/extension/' . $extensions[0]->id . ',' . $extensions[0]->id . '/presence')
                  ->multipart();

$presences00 = $platform->get('/account/~/extension/~')
                  ->json();

echo "<textarea style='width:100%;height:500px;'>";
                  print_r($presences00);
                  echo "</textarea>";

print 'Presence loaded ' .
  $extensions[0]->name . ' - ' . $presences[0]->json()->presenceStatus . ', ' .
  $extensions[0]->name . ' - ' . $presences[1]->json()->presenceStatus . PHP_EOL;

下面是指向实际PHP文件的工作链接:http://silkrut.com/william2/vendor/ringcentral/ringcentral-php/demo/ext.php

Ring的文档:在https://devcommunity.ringcentral.com/ringcentraldev/topics/where-could-i-lookup-my-accountid-and-extensionid-st8045nl19xkj的底部写着“Tyler,官方代表,顺便说一下,发送一个GET请求到/restapi/v1.0/account/~/extension,以获得您帐户中扩展的列表”。

如果有人能帮助或知道我在这里可能出错的地方,我将非常感激!谢谢您抽出时间来!

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2018-05-22 18:19:08

要获得所有扩展的存在,只需使用管理扩展登录,然后调用Company存在端点即可。

代码语言:javascript
运行
复制
$presences = $platform->get('/account/~/presence');

如果您想获得详细的状态,请记住添加标志。

代码语言:javascript
运行
复制
$presences = $platform->get('/account/~/presence?detailedTelephonyState=true');
票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/50470216

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档