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

Import Gliffy diagram to Confluence page via Rest API

Victor June 17, 2021

I have diagram file in Gliffy format (filename.gliffy). It can be made using export or another tool.

But how can I import it on Confluence page using Rest API? I tried to do it via file attachment, but diagram didn't appear on the page (but it is quite understandable).

I need exactly automated process (Rest API), not manual import.

Thank you

Victor.

1 answer

1 accepted

1 vote
Answer accepted
Davin Studer
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
June 17, 2021

Do you have the Gliffy app for confluence as well? Without that Confluence will not be able to render the Gliffy attachment correctly. If indeed you do here's what I would do. Manually create a Gliffy diagram and save the page. Then look at the storage format that is created for this. (Page menu -> Storage Format). This will tell you the structure that you need to add into your page content to point to the Gliffy file you uploaded to the page. Then you would use this REST endpoint to update your page content to add in the storage format the structure that points to the attached Gliffy file.

URL: http(s)://{confluence base url}/rest/api/content/{pageid}
Method: PUT

 

Victor June 18, 2021

Thank you, Davin. You solution helps.

I attach two files, .png and .gliffy. It is imporant to set correct comments on files - GLIFFY IMAGE and GLIFFY DIAGRAM. Gliffy  diagram file must be without extension.

I couldn't find Page menu -> Storage Format, but I made GET request 

/rest/api/content/354568600?expand=body.storage

on page with sample gliffy diagram to see page body, it returns macro in body:

<ac:structured-macro ac:name=\"gliffy\" ac:schema-version=\"1\" ac:macro-id=\"4c35e5ac-c7b5-41c0-847f-4e31b6734512\"><ac:parameter ac:name=\"name\">diag111</ac:parameter><ac:parameter ac:name=\"pagePin\">1</ac:parameter><ac:parameter ac:name=\"\" /></ac:structured-macro>

Further I PUT page in Confluence with macro, and all was fine, diagram  draws correctly. I didn't change macro-id, but there was no errors.

Like Davin Studer likes this
Davin Studer
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
June 18, 2021

This is where you can see the storage format of a page. The other option would be to add in the Confluence Source Editor app. It's a free app made by Atlassian. It gives you the option to edit the page storage format while you are in edit mode.

image.png

Like Victor likes this
Victor June 21, 2021

Yes, I watched this menu, but no 'Storage format', Export to PDF came right after View Source. May be not all features are installed or problems in access rights.

Davin Studer
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
June 21, 2021

Yeah, looks like you need to be a space admin to see that menu item. What you did works as well ... using the REST API to view the storage format ... it's just not as convenient.

Nachiketh Subramanya N September 13, 2023

@Davin Studer 

Is there an API Call we can use to mass download Gliffy diagrams from Spaces instead of Pages?

Please let me know, would be really helpful to know if that's available.

Thanks,

Nachiketh.

Samie Kaufman - Your Gal at Gliffy
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
September 13, 2023

Hi @Nachiketh Subramanya N ! 

I'm not sure if this is possible. I'd like to invite you to email our support team at support@gliffy.com. They may be able to provide some detail. :) 

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events