I am using trello attachments API to attach files to Trello card. There are limitations on file sizes.
There is a 10 MB file upload limit per attachment. However, Business Class and Trello Gold members have a 250 MB file upload limit per attachment.
I need to do below validations, before attaching file to Trello card.
1.If account type is general, check file size is <=10 MB.
2.If account type is not general, check file size is <=250MB.
To perform these validations, I need to get the account details of trello user. I'd appreciate any suggestions.
If you make a request to https://trello.com/1/members/me (or replace "me" with a user ID) then it returns an object that includes a "premiumFeatures" array. If it includes the "largeAttachments" feature then you're good to go.
(You can also get all sorts of good info on the user with this API call, see more here: https://developers.trello.com/v1.0/reference#membersid)
Thanks @Dan Lew. I got below response when I make a request to https://trello.com/1/members/me.
I would like to know what does mean by memberType in above response. Can I use this property to validate attachment file size. If yes, could you please list down the all possible values of memberType property?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I wouldn't use "memberType" to determine attachment size. Checking the "premiumFeatures" array is best because it accounts for all the ways that a user could acquire the ability to upload large attachments.
Currently, there are two ways the user can gain the ability to upload large attachments - either the user has Trello Gold, or they're a member of a Business Class team. Checking both of those states is much more tedious than just checking the "premiumFeatures" array. It'll also work better in the long run, in case we ever added more ways to enable large attachment uploads.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.