【问题标题】:Podio Php - limit the amount of item fields returnedPodio Php - 限制返回的项目字段的数量
【发布时间】:2017-08-27 20:25:21
【问题描述】:

有什么方法可以限制在过滤应用中的项目时返回的字段。我不想返回所有字段,而是只返回 item-id 和 title 字段

【问题讨论】:

  • 您可以添加一些您尝试过的代码示例吗?
  • 稍后当我启动笔记本电脑时,我将不得不发布实际代码。我用这个作为例子。但它返回整个项目。我想选择返回哪些字段。developers.podio.com/doc/items/filter-items-4496747

标签: php podio


【解决方案1】:

您可以为此使用字段参数。 有关它如何工作以及如何使用它的更多详细信息就在这里:https://developers.podio.com/index/api 在“使用字段参数捆绑响应”部分。

使用字段捆绑对象可以大大减少您必须发出的 API 请求数量。

您很可能正在寻找fields=items.view(micro) 参数。 Podio API 将为每个项目仅返回 5 个值: app_item_iditem_idtitlelinkrevision

PHP示例

$items = PodioItem::filter($appCreds->app_id, 
                           array('limit' => $maxItems, 
                                 'offset' => $offset, 
                                 'filters' => $filters ), 
                           array('fields' => 'items.view(micro)'));

【讨论】:

  • 工作就像一个魅力!实现: $actionExists = PodioItem::filter($appCreds->app_id, array( 'limit' => $maxItems, 'offset' => $offset, 'filters' => $filters ), array('fields' => 'items.view(micro)', ));
  • 感谢您的确认,我已将您的示例包含在答案中以提高可见性
  • 有什么方法可以返回特定的字段子集(以减轻工作量),而不仅仅是默认的mini/micro/full 视图?跨度>
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2011-04-27
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多