Skip to main content
Question

Example code for Python (Django)

  • 3 July 2024
  • 4 replies
  • 63 views

Hello,

 

I’m new to Miro and I’m trying to use Auth2 to manipulate documents. But I can’t find out how to get de access_token with Python (Django) with or without miro_api. 

I created an app and have cliendid and secret. I created a return_path in my application.
Does anyone have some example code for getting the access_token?

 

Thanks in advance!

4 replies

Userlevel 2
Badge

Hi @Ernst van der Heijden,

Welcome to the development for Miro! I am not sure if you’re using the python client, but even if you’re not, there are some tips in the readme, and we have a small app example as well. Let me know if this doesn’t help!

Thanks,

Elena.

Userlevel 1
Badge +2

Hi thanks for your reply, I’ve managed to connect to the API with the miro_api python package.

One question though, is it possible when using the miro_api package to create a board and pass paramaters like name, description, etc? I find it hard to understand the documentation

Userlevel 1
Badge +2

Hai Elena,

With the given code I am able to create a new document with a name.

url = "https://api.miro.com/v2/boards"payload = {    "name": "{doc_name}",    "description": "{doc_description}",}headers = {    "accept": "application/json",    "content-type": "application/json",    "authorization": "Bearer {token}",}response = requests.post(url, json=payload, headers=headers)

So far so good, but where can I find the commands and or code to copy an existing document and to
change an existing document. I know that I have to use ‘put’ to copy the document, but I can’t find out more.

I have managed to assemble the above code from https://miroapp.github.io/api-clients/python/miro_api.html#MiroApi.api_client.

Can you please help me out? If I get this all done I have need for 7-10 more licenses for many years to come. So good business I’d say.

Userlevel 6
Badge +1

Hi @Ernst van der Heijden 

 

Thanks for your questions! In the other thread you posted, Alexander answered your questions. I hope you find it helpful. Cheers.

Reply