podio - 未捕获 PodioBadRequestError : "Must specify either ' embed' or 'url' "

标签 podio

我需要为跑道中的嵌入字段设置值,这是我的代码:

            $field_id='pdf-property-information';
            $options=$item->fields[$field_id]->values;
            if(empty($options)) 
                $item->fields[$field_id] =  new PodioEmbedItemField($field_id);

            // Create embed
            $embed = PodioEmbed::create(array('url' => $pdf_property_information));

            // Set using object
            $item->fields[$field_id]->values = $embed;

            // Set using associative array
            $item->fields[$field_id]->values = array('embed_id' => $embed->embed_id);

这是我得到的错误:

Fatal error: Uncaught PodioBadRequestError: "Must specify either 'embed' or 'url'" Request URL: http://api.podio.com/item/826141668 Stack Trace: #0 /home/apibind/public_html/mail_chimp/podio-php-4.3.0/lib/Podio.php(355): Podio::request('PUT', '/item/826141668', Array) #1 /home/apibind/public_html/mail_chimp/podio-php-4.3.0/models/PodioItem.php(183): Podio::put('/item/826141668', Array) #2 /home/apibind/public_html/mail_chimp/podio-php-4.3.0/models/PodioItem.php(66): PodioItem::update(826141668, Array, Array) #3 /home/apibind/public_html/sourcingplatform/trunk/add.php(403): PodioItem->save() #4 {main} thrown in /podio-php-4.3.0/lib/Podio.php on line 289

最佳答案

您必须使用数组键“embed”传递embed_id。这里你的最后一行将是这样的,

 // Set using associative array
 $item->fields[$field_id]->values = array('embed' => $embed->embed_id);

关于podio - 未捕获 PodioBadRequestError : "Must specify either ' embed' or 'url' ",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/49816043/

相关文章:

node.js - Podio API addItem 调用

php - 跑道 API 请求中的 App token 为空

ios - ID 为 xxxxxxxx 的应用程序在 id 为 yyyy 的应用程序上没有正确的 view_struct

javascript - 在跑道中将计算日期字段设置为 null(因此使用 javascript)

php - 在跑道中通过一个请求上传多个文件(建议)

ios - 是否可以通过其他应用程序使用 Podio iOS 应用程序? IE。打开跑道并在应用程序中显示特定条目

python - Python 中 Podio 文件上传失败

c# - PODIO JSON Feed to C# 对象多态性

c# - 使用 API 邀请 ShareFile 用户加入跑道工作区

javascript - 如何使用 REST API 将字段更新为新值?