Trello API:创建新卡了PHP code的 [英] Trello Api: Create new Card out of PHP Code

查看:235
本文介绍了Trello API:创建新卡了PHP code的的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想创建一个新的Trello卡,当一个新用户注册我们的web应用。

要做到这一点我要求一个读,写令牌为我的用户(允许其命名为即为MyToken),我有我的应用程序键(可以将其命名为的myKey)。

由于我找不到任何PHP-包装我第一次使用提琴手测试HTTP-POST请求。具体来说,我尝试了以下内容:

  HTTP-POST网址:
http://api.trello.com/1/cards请求头:
用户代理:提琴手
主持人:api.trello.com
内容长度:177请求正文:
关键=&的myKey放大器;令牌=即为MyToken&放大器;名称= newCardName&安培; DESC = newCarddescription&安培; IDLIST = myListId

然而,这并不工作。我回来了HTML的code,显示一个网站,告诉用户登录!我在做什么错了?


解决方案

感谢@Daniel LeCheminant。
我犯了两个错误:

1。)我用HTTP代替https的
2)我把变量请求主体。即使它是一个POST请求,trello预计在URL中的变量

该解决方案适用于我:

<$p$p><$c$c>https://api.trello.com/1/cards?key=myKey&token=myToken&name=newCardName&desc=newCarddescription&idList=myListId

I would like to create a new Trello Card when a new User signs up for our webapplication.

To do that I requested a "read,write" Token (lets name it "myToken" ) for my user and I have my application key (lets name it "myKey").

Because I could not find any PHP-Wrapper I first used Fiddler to test the HTTP-Post request. Specifically I tried the following:

HTTP-POST

URL: 
http://api.trello.com/1/cards

Request-Headers: 
User-Agent: Fiddler
Host: api.trello.com
Content-Length: 177

Request Body:
key=myKey&token=myToken&name=newCardName&desc=newCarddescription&idList=myListId

However this doesnt work. I get back an HTML-Code, that shows a website which tells the user to login! What am I doing wrong?

解决方案

Thanks @Daniel LeCheminant. I made two mistakes:

1.) I used http instead of https 2.) I put the variables in the request body. Even though it is a post request, trello expects the variables in the url itself

This solution works for me:

https://api.trello.com/1/cards?key=myKey&token=myToken&name=newCardName&desc=newCarddescription&idList=myListId

这篇关于Trello API:创建新卡了PHP code的的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆