Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

Next challenges

Recent achievements

  • Global
  • Personal

Recognition

  • Give kudos
  • Received
  • Given

Leaderboard

  • Global

Trophy case

Kudos (beta program)

Kudos logo

You've been invited into the Kudos (beta program) private group. Chat with others in the program, or give feedback to Atlassian.

View group

It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

Trello api add PDF attachment will always return unsuccessful response

Hi guys,

When I upload a pdf to a Trello card. the response will always include this:
```

bytes: null,

isUpload: false,
```

as if the upload failed. But the upload actually succeeded....
This only happens when I upload a pdf

I tried to play with the mime type I used: application/pdf, x-pdf, image/png

Does anyone know how to get the API to return a successful response?

Thanks in advance!

3 answers

0 votes
Iain Dooley Community Leader May 26, 2020

@Jamahl M-D I've never been able to make file uploading work in the Trello API, I just attach links -- internally they're represented as links anyway. You might like to review the discussion here:

https://community.atlassian.com/t5/Trello-questions/Mime-types-of-attachments-uploaded-to-Trello/qaq-p/1369920#M26380

I'm having the same issue using Invoke-RestMethod in PowerShell in creating a new card with a PDF attachment. If the attachment is a simple .txt it works fine. I'm guessing it has something to do with encoding. Does anyone have a code example in PowerShell with attaching anything other than a .txt to a new card?

Iain Dooley Community Leader Sep 29, 2020

Thanks for the tip, I posted over there and will relay the answer here if I get one

Update:
I figured it out. The file needs to be in a form using system.io.fileinfo. I'm on PowerShell 7 and I believe you might have to get into some .NET to make it work on PS5.1.

$FORM = @{
    idList     = "xxxxxx"
    pos        = "top"
    name       = "TestTest"
    fileSource = [system.io.fileinfo]"C:\Path\Path\File.pdf"
}

Invoke-RestMethod -Method Post -Uri "https://api.trello.com/1/cards?$APIKEY" -Form $FORM

 

Suggest an answer

Log in or Sign up to answer
TAGS
Community showcase
Published in Trello

📹 What is Trello?

Hello Community!  My name is Brittany Joiner and I am a Trello enthusiast and Atlassian Community Leader. I'll be sharing with you a series of videos with my top tips on how to best use Trello...

872 views 15 30
Read article

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you