When trying to create a card using the API through the developers website with an attachment (see below)
var request = require("request");
var options = {
method: 'POST',
url: 'https://api.trello.com/1/cards',
qs: {
name: 'New Card',
desc: 'this is the description',
idList: '{my idList here}',
fileSource: 'data:text/plain;name=ads.txt;base64,Z29vZ2xlLmNvbSwgcHViLTMyNDQzOTEzNDI4NDE4NjksIERJUkVDVCwgZjA4YzQ3ZmVjMDk0MmZhMA==',
keepFromSource: 'all',
key: '{my key here}',
token: '{my token here}'
}
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
I get this as the response:
{"message":"Must provide either url or file""error":"VALIDATOR_INVALID_VALUE"}
But I am providing a "fileSource" so I'm not sure why it's telling me that I must provide either url or file when I am providing a file. I can't seem to get around this.
Any help would be appreciated.
Thanks,
Nir
@Nir Modiano I've never been able to make "real" file uploads work with the API, I just assume it doesn't work. Maybe @bentley has some clues (I'll be listening closely)!
Even looking at whether or not attachments are files or links via the API seems to always return links -- as far as I can tell, attachments are always links, but somehow if you upload them via the Trello interface it flags them differently so you see the "PDF" or "DOC" icon, but via the API, I've only been able to create a link.
If I don't want this to look like it's a link, and instead want it to look like a file, I actually download it to Drive first then post the drive link to the file.
I think that I've only ever gotten a file to upload via API if I sent it as form-data.
I put together this Glitch project to play around with attachments awhile go. Taking a look at it might be helpful: https://glitch.com/~trello-attachments-api
I'd also recommend asking questions about the API over here: https://community.developer.atlassian.com/c/trello. There are other developers familiar with Trello that might be able to offer better advice.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.