dongtuo6562 2016-08-15 10:26
浏览 23

通过trello api创建团队/组织

I want to create trello teams automatically via an html form from my website.

I wrote a php script that seems to work. For example I can get list of boards or create a new board. But it does not works to create teams.

HTML CODE

<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
</head>
<body>

<form action="api_method.php" method="post">
  Project Name:<br>
  <input type="text" name="projectName" value="board_test">
  <br><br>
  <input type="submit" value="Submit">
</form> 

<p>If you click the "Submit" button, the form-data will be sent to a page called "api_method.php".</p>

</body>
</html>

I then use a php script to create the new board:

<?php
require("trello_api.php");
$key = 'mykey';
$token = 'mytoken';
$trello = new trello_api($key, $token);

$data = $trello->request('GET', ('member/me/boards'));

$obj = array('name' => $_POST['projectName']);


$trello->request('POST', ('/boards'),$obj);


echo "Board name: " . $data[0]->name . "
 
";
echo "New board: " . $_POST['projectName'];

?>

So that works perfectly but not when I try to do the same thing with "organizations" it doesn't work

$trello->request('POST', ('/organizations'),$obj);

Can you please help me.

  • 写回答

1条回答 默认 最新

  • doupai8095 2016-08-15 12:40
    关注

    I found the solution, I had to use the option "displayName" instead of "name"

    <?php
    require("trello_api.php");
    $key = 'myKey';
    $token = 'myToken';
    $trello = new trello_api($key, $token);
    
    $data = $trello->request('GET', ('member/me/boards'));
    
    $obj = array('displayName' => $_POST['projectName']);
    
    
    $trello->request('POST', ('/organizations'),$obj);
    
    
    echo "Board name: " . $data[0]->name . "
     
    ";
    echo "New board: " . $_POST['projectName'];
    
    ?>
    
    评论

报告相同问题?

悬赏问题

  • ¥20 求个正点原子stm32f407开发版的贪吃蛇游戏
  • ¥15 正弦信号发生器串并联电路电阻无法保持同步怎么办
  • ¥15 划分vlan后,链路不通了?
  • ¥20 求各位懂行的人,注册表能不能看到usb使用得具体信息,干了什么,传输了什么数据
  • ¥15 个人网站被恶意大量访问,怎么办
  • ¥15 Vue3 大型图片数据拖动排序
  • ¥15 Centos / PETGEM
  • ¥15 划分vlan后不通了
  • ¥20 用雷电模拟器安装百达屋apk一直闪退
  • ¥15 算能科技20240506咨询(拒绝大模型回答)