Facebook Workplace帐户管理API未返回照片



我对Facebook工作场所的帐户管理API有问题。我要做的就是构建一个快速简便的员工目录,它可以抓住我们所有的活跃用户,并吐出他们的名字,标题,部门和照片。问题是,回来的数据似乎与上面链接中所示的Facebook核心模式不符。一些模式数据会返回,但无论我似乎尝试什么,都不会拍照。

private function getEmployees()
{
    $done = false;
    $current_index = 1;
    $current_page = 1;
    $results = [];
    while(!$done) {
        $res = $this->client->request(
            'GET',
            'https://www.facebook.com/company/XXXXXXXXX/scim/Users?count=100&startIndex=' . $current_index,
            [
                'headers' => ['Accept' => 'application/json',
                    'Content-Type' => 'application/json',
                    'Authorization' => 'Bearer ' . $this->token
                ]
            ]
        );
        $decoded = json_decode($res->getBody());
        $total = $decoded->totalResults;
        $perPage = $decoded->itemsPerPage;
        if (isset($decoded->Resources)) {
            $results = array_merge($results, $decoded->Resources);
            if (($current_page * $perPage) >= $total) {
                $done = true;
            } else {
                $current_page++;
                $current_index += $perPage;
            }
        } else {
            $done = true;
        }
    }
    return $results;
}

回馈:

object(stdClass)[392]
public 'schemas' => 
array (size=3)
  0 => string 'urn:scim:schemas:core:1.0' (length=25)
  1 => string 'urn:scim:schemas:extension:enterprise:1.0' (length=41)
  2 => string 'urn:scim:schemas:extension:facebook:starttermdates:1.0' (length=54)
public 'id' => int 10001156699923
public 'userName' => string 'np@lt.com' (length=21)
public 'name' => 
object(stdClass)[393]
  public 'formatted' => string 'Nick P' (length=11)
public 'title' => string 'Lead PHP Engineer' (length=17)
public 'active' => boolean true
public 'phoneNumbers' => 
array (size=1)
  0 => 
    object(stdClass)[394]
      public 'primary' => boolean true
      public 'type' => string 'work' (length=4)
      public 'value' => string '+1631123456' (length=12)
public 'addresses' => 
array (size=1)
  0 => 
    object(stdClass)[395]
      public 'type' => string 'attributes' (length=10)
      public 'formatted' => string 'Manhattan' (length=9)
      public 'primary' => boolean true
public 'urn:scim:schemas:extension:enterprise:1.0' => 
object(stdClass)[396]
  public 'department' => string 'IT' (length=2)
  public 'manager' => 
    object(stdClass)[397]
      public 'managerId' => int 100011017901494
public 'urn:scim:schemas:extension:facebook:starttermdates:1.0' => 
object(stdClass)[398]
  public 'startDate' => int 0
  public 'termDate' => int 0

您可以看到,它返回其他属于"核心"模式的字段,但缺少"照片"数组和其他字段。我认为这可能是因为用户没有任何照片,但是几乎所有的都有个人资料图片,而且许多都有更多照片。我尝试专门获取他们的用户信息,但遇到了相同的结果,没有照片。

有人尝试过类似的事情吗?任何帮助都非常感谢,这对我们来说都是一个路障。

谢谢

要获取个人资料信息,不要使用scim,而是图形APIhttps://graph.facebook.com/community/members将列出所有成员

和https://graph.facebook.com/[email]您的成员之一将获得所有信息。

之后,您必须设置要使用字段参数获得的参数。

在我们的实施中,我们从此请求中获取全部数据

https://graph.facebook.com/xxxx/members?fields= email,picture.type(大(,链接,link,title,first_name,first_name,last_name,dementment,dementment,updated_time,updated_time,emage}& amp; amp; amp; amp;/p>

最新更新