我正在尝试在PHP的podio API中创建一个项目。这是我的代码:
Podio::setup($client_id, $client_secret);
Podio::authenticate_with_app($app_id, $app_token);
// Create a field collection with some fields.
// Be sure to use the external_ids of your specific fields
$fields = new PodioItemFieldCollection(array(
new PodioTextItemField(array("external_id"=>"first", "values"=> "Han")),
new PodioTextItemField(array("external_id"=>"last", "values"=> "Solo"))
));
// Create the item object with fields
// Be sure to add an app or podio-php won't know where to create the item
$item = new PodioItem(array(
'app' => new PodioApp($app_id), // Attach to app with app_id=$app_id
'fields' => $fields
));
// Save the new item
$item->save();
但我收到错误
Notice: Undefined index: request in C:\xampp\htdocs\PodioAPITesting\vendor\podio\podio-php\lib\PodioError.php on line 11
Fatal error: Uncaught PodioMissingRelationshipError: "Item is missing
relationship to app" Request URL: Stack Trace: #0 C:\xampp\htdocs\PodioAPITesting\testPodioAPI.php(66): PodioItem->save() #1 {main} thrown in C:\xampp\htdocs\PodioAPITesting\vendor\podio\podio-php\models\PodioItem.php on line 75
我是否正确创建了该项目?可能是因为这个应用程序有更多的两个字段? (我想设置'first'
和'last'
,暂时将其他字段留空)
答案 0 :(得分:1)
问题是我的$app_id
是一个字符串,应该是一个整数。