I have tried doing this via Chello (a .NET wrapper for the Trello API) and via Fiddler. In both cases I am getting back a 400 response with "invalid value for name".
Here is the request and response data. Please note I have changed the key, token, and idList for security reasons. Also the token does have read/write permission.
POST https://api.trello.com/1/cards?key=<myKey>&token=<myToken> HTTP/1.1
User-Agent: Fiddler
Host: api.trello.com
Content-Length: 115
{
name: "My new card name",
desc: "My new card description",
idList: "<myIdList>"
}
HTTP/1.1 400 Bad Request
X-Powered-By: Express
Content-Type: text/plain; charset=utf-8
Content-Length: 23
Cache-Control: max-age=0, must-revalidate
Expires: Thu, 01 Jan 1970 00:00:00
Access-Control-Allow-Origin: *
Access-Control-Allow-Methods: GET, PUT, POST, DELETE
Connection: keep-alive
invalid value for name
Any help with this issue would be appreciated.
Despite using POST, the Trello API actually expects the values to be in the query string rather than in the POST body. Your example should be more along the lines of:
https://api.trello.com/1/cards?key=<myKey>&token=<myToken>&name=My+new+card+name&desc=My+new+card+description&idList=<myIdList>
Using the code you posted, you end up with an "invalid value for name" because it is the first parameter it checks for and does not find.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With