PODIO php API调用,使用应用程序ID过滤器获取所有项字段值的数组偏移量

PODIO php API调用,使用应用程序ID过滤器获取所有项字段值的数组偏移量,php,json,api,podio,Php,Json,Api,Podio,我是API方面的新手,我正在使用PODIO链接的PHP客户端,我想获得所有项的所有字段值 下面的代码不起作用,但是如果我使用了PodioItem::get_basic(item_id),这可以获取与项目相关的值,但我想获取所有项目的所有字段值,因此我使用了按应用id筛选,我得到了一个错误未定义的属性:PodioItemCollection:$fields <?php require_once '/PodioAPI.php'; $client_id = "xxxx"; $client_

我是API方面的新手,我正在使用PODIO链接的PHP客户端,我想获得所有项的所有字段值

下面的代码不起作用,但是如果我使用了
PodioItem::get_basic(item_id)
,这可以获取与项目相关的值,但我想获取所有项目的所有字段值,因此我使用了按应用id筛选,我得到了一个错误
未定义的属性:PodioItemCollection:$fields

<?php 

require_once '/PodioAPI.php';

$client_id = "xxxx";
$client_secret = "xxxx";
$app_id = xxxx;
$app_token = "xxxx";

Podio::setup($client_id, $client_secret);
Podio::authenticate_with_app($app_id, $app_token);

$item = PodioItem::filter($app_id);
$field_id = 'dashboard-link-2';
$collection = $item->fields[$field_id]->values;

foreach ($collection as $embed) {
  print "Embed id: ".$embed->embed_id."<br>";
  print "Embed URL: ".$embed->original_url."<br>";
}

您需要遍历字段数组,以找到
external\u id
与您要查找的字段相同的字段。看起来您正在查找具有
external\u id=='dashboard-link-2'

编辑#1添加示例:

$collection = []
foreach ($item->fields as $field) {
  if ($field->external_id == "dashboard-link-2") {
    $collection = $field->values;
  }
}

编辑#2:看了一下文档,我的代码是针对库的较旧/不同版本的。抱歉

嗨,杰,谢谢你的回答!我想我已经在这行
$item->fields[$field\u id]
@MarlZ15199上完成了,您的
仪表板链接-2
没有
嵌入\u id
。这就是问题所在吗?是的,如果我使用filterbyitemid函数,我会得到一个结果,如果我使用filterbyappID,我不会得到任何结果。我尝试了你提供的代码,如下所示。它无法工作,出现错误
未定义属性:PodioItemCollection::$fields
<代码>$items=PodioItem::filter($app\u id)$字段_id='dashboard-link-2';foreach($items->fields as$field){如果($field->external_id==“dashboard-link-2”){$collection=$field->values;}似乎不起作用,我会得到错误:未定义属性:PodioItemCollection:$fields
$collection = []
foreach ($item->fields as $field) {
  if ($field->external_id == "dashboard-link-2") {
    $collection = $field->values;
  }
}