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

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

Unauthorized Organization

First off, I am totally new to REST API's and Python 🙃

 

I am trying to piece together an automated export of a Trello board and have looked through the code offerings of some other users: trello-python-demo/demo_bc_org_backup.py at 57f57b4577a3179650b3421cb4f299394828d337 · bmccormack/trello-python-demo · GitHub, Atlassian documentation.

 

I currently have this written and making a POST but I am getting a "unauthorized organization" error. Any thoughts on what I might be doing wrong? (I am not a business class user myself, but I am part of a team)

 

# This code sample uses the 'requests' library:
# http://docs.python-requests.org

import requests
import json

# Set key and token here or get it from settings.py (preferred)
key = ''
# if you're storing your key in this file, you don't need the following three lines
if not key:
from settings import trello_key
key = trello_key

token = ''
# if you're storing your token in this file, you don't need the following three lines
if not token:
from settings import trello_token
token = trello_token

board = ''
# if you're storing your token in this file, you don't need the following three lines
if not board:
from settings import master_id
board = master_id

org = ''
# if you're storing your token in this file, you don't need the following three lines
if not org:
from settings import org_id
org = org_id

# CREATE EXPORTS



# get boards
#url = "https://api.trello.com/1/boards/%s/cards" % (board)
# get org export
url = "https://api.trello.com/1/organizations/%s/exports" % (org)

headers = {
"Accept": "application/json"
}

query = {
'key': key,
'token': token,
}

response = requests.request(
"POST",
url,
headers=headers,
params=query
)

#response = requests.request(
# "GET",
# url,
# headers=headers,
# params=query
#)

# Simple text return for testing
print(response.text)

# print(json.dumps(json.loads(response.text), sort_keys=True, indent=4, separators=(",", ": ")))

 

1 answer

1 accepted

0 votes
Answer accepted
Vini Atlassian Team Jan 11, 2021

Hi Isaac, welcome to the Trello community!

For this type of question, I believe you are much more likely to get an answer by posting on our Developers Community instead: https://community.developer.atlassian.com

Many experienced developers as well as Trello Engineers are often hanging out in that forum and I'm sure someone will be able to help with your API questions there!

Suggest an answer

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

Taco Tuesday: Your favorite Trello blog takeaway

Hello friends! From the community that brought you Welcome Wednesday, Throwback Thursday and Friday Fun, welcome to Taco Tuesday, a weekly discussion about all things Trello. The best part? One Tac...

67 views 4 3
Join discussion

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