[英]How to get field data for an item using Podio PHP API
When using the Podio PHP API and after getting an item collection using: 使用Podio PHP API并使用以下方法获得项目集合后:
$item_collection = PodioItem::filter( $app_id, $attributes );
How can I get the value(s) of a field with an external_id
of, for example, email
? 如何获取具有
external_id
的字段的值,例如email
?
Currently I loop through all the items like this: 目前,我遍历所有此类项目:
$items = [];
foreach ($item_collection as $item) {
$email = "";
foreach ( $item->fields as $field ) {
if( $field->external_id == "email") {
$email = trim($field->values);
} //repeat for each field eg 'name'
}
$items[] = array (
'email' => $email,
'name' => $name //etc
);
}
Is there a way to directly get the field value without looping through all the fields in the whole collection of items? 有没有一种方法可以直接获取字段值,而无需遍历整个项目集合中的所有字段?
Using PodioItem::get_field_value
obviously makes another request which seems counter to getting all the items from PodioItem::filter
. 使用
PodioItem::get_field_value
显然会发出另一个请求,这似乎与从PodioItem::filter
获取所有项目PodioItem::filter
。
There is an direct api call is there, but unfortunately that method is not available in the client it seems. 那里有直接的api调用,但不幸的是,该方法似乎在客户端中不可用。 hope this urls help you.
希望此网址对您有所帮助。 https://help.podio.com/hc/en-us/community/posts/200516418-Get-Field-Values-from-Item-by-external-id-PHP-
https://help.podio.com/hc/zh-CN/community/posts/200516418-Get-Field-Values-from-Item-by-external-id-PHP-
https://developers.podio.com/doc/items/get-item-by-external-id-19556702 https://developers.podio.com/doc/items/get-item-by-external-id-19556702
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.