How can i display a macro of draw.io to confluence page using rest API

이성우 June 15, 2023
There is a process that requires Python programming to create a drawio file and then save the file to confluence via REST API.
It was easy to register the drawio file created in Python as the attach file of confluence, but I can't figure out how to display it in macro format on the screen as shown in the image below.
Please use a helpful site or Q&A, direct code.
캡처.PNG
from N2G import drawio_diagram
import requests

diagram = drawio_diagram()
diagram.add_diagram("Page-1")
diagram.add_node(id="R1")
diagram.add_node(id="R2")
diagram.add_link("R1", "R2", label="DF", src_label="Gi1/1", trgt_label="GE23")
diagram.layout(algo="kk")
diagram.dump_file(filename="Sample_graph.drawio", folder="./Output/")

data = {
    'type': 'page',
    'title': 'test',
    'version': {'number': 1 + 1},
    'body': {
        'storage': {
            'value': '',
            'representation': 'storage'
        }
    }
}
headers = {"X-Atlassian-Token": "nocheck"}
files = {'file': ('./Output/Sample_graph.drawio', open('./Output/Sample_graph.drawio', 'rb'), 'application/vnd.jgraph.mxfile')}
requests.post(url+'/child/attachment', data=data, auth=('id', 'password'), files=files, headers=headers, verify=False)

0 answers

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events