私は現在、セットアップに成功した basecamp への単純な API 呼び出しに取り組んでいます。
- 新しい計画
- やることリスト
- リストの todo アイテム
現在、API の php ラッパー ( https://github.com/bdunlap/basecamp.phpにあります) と foreach ループを使用してこれを完了しています。しかし、それには時間がかかり、これがこれを達成するための最良の方法であるとは思えません.
私の質問: 一度に複数の todo アイテムを追加することは可能ですか?? 理想的には 20 個のアイテムを追加したいと考えています。github のドキュメントには、単一のアイテムの追加のみが記載されています ( https://github.com/basecamp/bcx-api/blob/master/sections/todos.md#create-todo ) ネストされた配列を試しましたが、うまくいきませんでした。
私が使用したコードは以下のとおりです
/*** Create a new todo list:*/
$todolist =array('name' => 'Post Project', 'description' => 'Things to complete after project is completed');
$ProjectToDoList = $basecamp('POST', '/projects/'.$newProject->id.'/todolists.json', $todolist);
echo "Post Project Todo List ID is {$ProjectToDoList->id}\n";
/*** just incase i want to add due dates in the future *****/
//array('content' => '3 month review contact client'),
/*** just incase i want to add due dates in the future *****/
/*** Add todo items to the Post Project list ****/
$todoItems = array(
array('content' => 'User guide supplied'),
array('content' => 'Client Training Completed'),
array('content' => '3 month review contact client'),
array('content' => 'Add to mailchimp mailing list and set up auto responder')
);
foreach($todoItems as $todoItem){
$ToDoListItem = $basecamp('POST', '/projects/'.$newProject->id.'/todolists/'.$ProjectToDoList->id.'/todos.json', $todoItem);
}