Getting unauthorized member permission requested with customBoardBackground

I am trying to upload use the customBoardBackground endpoint from C#. My token is created with scope=read,write,account However, when I try to upload, all I get is unauthorized member permission requested. Does someone have some working code? I’ve tried with various combinations of a url on the querystring, form data, and straight binary. Always the same response. Thanks for the help!

Hello @Toma_TE

Do you get the same error when you try with just a plain key + token auth method instead of OAuth? Have you tested the request using another tool like Postman to check your method?

I should have said my ultimate goal is C#, right now, I’m just trying through postman. I am using the key from my Power Up and the token when I authorize. I don’t know any other way to access the API. If I could see a working sample, even through PostMan, that would probably help.

Start by making a request to see if you can at least read the member’s custom board background:

GET
https://api.trello.com/1/members/{memberId}/customBoardBackgrounds?key={TrelloKey}&token={TrelloToken}

Yes, I can read the backgrounds. I can make new boards, I can add cards, I can really do everything I want. Except add new custom backgrounds. I can even assign a background to a board as long as it is already in trello. I just can’t upload new images for backgrounds.

Hmmm, I’ve never used those endpoints before, but I just gave them a test.

Firstly, the documentation about the associated endpoints is very strange, as the two POST endpoints Upload new boardBackground for Member and Create a new custom Board Background produce the identical results… they upload a binary of an image as a custom background.

I used Postman and it does the conversion of the image file to binary and sets the required headers:

I don’t know how to construct that request in C#, but try articles like these on how to use native C# functions / libraries to construct REST API requests that provide multipart/form-data for binary file uploads.

I think I might know why you’re getting the unauthorized member permission requested error. You can’t create a custom background for another user, only yourself!

I can upload custom backgrounds for my user account, which I can then set as the board background, which will apply to all other users. However, each particular user cannot see that custom background available in their set of backgrounds to choose from, they can only over-ride it to be something else.

So, backgrounds work like stickers… they are unique per user account (member), not per board.

Thank you for the screenshot, that made all the difference. I was using the wrong id for the user. I was using my username after the members in the url instead of the user id. I know, I know, rookie mistake. Thank you again, for helping me through.

1 Like