2016-12-14 101 views
0

我需要從項目的集合,其中包含電子郵件地址<my-email>如何在Podio API for PHP中通過電子郵件字段過濾項目?

這裏得到一個產品對象的那部分的結構:

[2] => PodioEmailItemField Object 
          (
           [__attributes:PodioObject:private] => Array 
            (
             [field_id] => <my-field-id> 
             [type] => email 
             [external_id] => email 
             [label] => Email 
             [values] => Array 
              (
               [0] => Array 
                (
                 [type] => work 
                 [value] => <my-email> 
                ) 

              ) 

這是我曾嘗試代碼:

$items = PodioItem::filter($app_id, array('filters'=> 
            array(
              'email'=> 
              array(
               'values'=> 
               array(
                 array(
                  'value'=>'<my-email>')))))); 

,但我不斷收到錯誤:

Fatal error: Uncaught PodioBadRequestError: "Invalid value {"values": [{"value": "<my-email>"}]} (object): must be array" 

我在這裏錯過了什麼?

我寧願使用external_id找到這個項目,而不是field_id

回答

1
$items = \PodioItem::filter($app_id, [ 
    'filters' => [ 
     // replace 123456 with field ID for your field with email type 
     '123456' => [ 
      '[email protected]', 
      // '[email protected]', 
      // '[email protected]' 
     ] 
    ] 
]); 

在您的應用程序的「開發」部分,你可以找到與電子郵件類型的域的域ID。 "Developer"

如果您打電話過濾多個電子郵件,那麼跑道會返回結果,如果其中一個將被發現。