Hi @Ernst van der Heijden ,
It is possible to create a copy of an existing board using Copy board API endpoint. Indeed, you need to use a PUT
request for that.
You can fill in the desired parameters (copy_from
, description
, name
, etc.) on the page and get a code example or try the endpoint right away.
From the code example you attached I might assume that you are using python. Here is how a python code to copy a board could look like:
import requests
url = "https://api.miro.com/v2/boards?copy_from=board_id"
payload = {
"description": "New description",
"name": "New name",
"teamId": "new_team_id"
}
headers = {
"accept": "application/json",
"content-type": "application/json"
}
response = requests.put(url, json=payload, headers=headers)
print(response.text)
Great Alexander, that works immediataly!
One last question for now:
What is the code for updating an items it’s content? I tried it with:
url = f'https://api.miro.com/v2/boards/{board_id}/items/{item_id}'
data = {"data": {"content": "<p>123</p>"}}headers = { "accept": "application/json", "authorization": f"Bearer {access_token}",}response = requests.patch(url, json=data, headers=headers)
Can you help me? And where can I find all the possibilities?
Hi @Ernst van der Heijden ,
The endpoint from your example can be used to update item’s position or parent only: Update item position or parent.
In order to update item’s content you need to use an endpoint specific to the item’s type. E.g. for sticky notes: Update sticky note item.
There item types you can update are: app_card
, card
, document
, embed
, frame
, image
, shape
, sticky_note
, text
You can find the corresponding endpoints in our API reference.