Solved

Use Lucid's Rest API to get Lucidchart shape library of documents

  • 18 October 2023
  • 5 replies
  • 105 views

Iam trying to integrate Lucid chart to a third party service to provide an  option import process diagrams from Lucid Chart to our clients 
I have asp.net web application 
and I have setup Oauth 2.0 and am able to retrieve document list and contents using Lucid Rest API . 
But in order to convert the et lucid document to BPMN which is the set format of data import in our application 
I want to get the details of the shape libraries and graph < 
is there an API which can fetch me the details of shape library and its Names without using a legacy API which requires Oauth 1.0 authentication .

icon

Best answer by Richard U 21 October 2023, 00:22

View original

Comments

Userlevel 4
Badge +7

Hi Vyshnavy

Thank you for your detailed post in the Lucid for Developers Community. It's great to hear that you've successfully set up OAuth 2.0 and are able to retrieve document lists and contents using Lucid's REST API.

To address your specific query about fetching details of shape libraries and their names currently Lucidchart's public APIs are focused on document manipulation and data retrieval but do not directly expose shape library details. 

However if your primary goal is to convert Lucidchart documents into BPMN format for import into your application you might consider parsing the document content you've already retrieved to map Lucidchart shapes to their BPMN equivalents. This would involve some manual mapping but would allow you to bypass the need for shape library details. I suggest reviewing this thread for tips.

Could you please clarify whether your aim is to extract shape data from Lucidchart to create BPMN diagrams in a third-party application or are you looking to create BPMN diagrams directly within Lucidchart? Your clarification will help us provide more targeted assistance.

Thank you @Richard U Richard for the response 
Here is a more detailed outlining of our objective.
In our mission to integrate Lucidchart with our application we aim to offer users the flexibility to import their BPMN processes into our project without limitations based on their preferred diagramming tools. 
Our application operates using the standard BPMN format for seamless execution of various process operations.
Our ideal scenario involves a smooth conversion of Lucidchart diagrams into the standard BPMN format ensuring seamless data integration into our third-party application.
In the event that direct conversion proves unfeasible we remain open to exploring alternative solutions that can accomplish the same objective.

Also to add another alternative solution we were considering was if we have an option to directly export csv file of the lucid chart projects through an external API. 

Userlevel 4
Badge +7

Hi Vyshnavy

Thank you for providing a more detailed outline of your objectives. Regarding your alternative solution of exporting Lucidchart projects as CSV files this is also a viable approach. While Lucid's REST API doesn't directly support CSV export you could retrieve the Document Contents JSON response and then write a custom script to convert it into CSV format.

For converting Lucidchart documents to standard BPMN format besides the suggestion of mapping our REST API's Document Contents export to BPMN shapes you may consider building a custom Lucid extension for your application. 

Would you be interested in a more in-depth discussion to explore building a custom extension to Lucid for your application using Lucid's Extension API?

Looking forward to your response.

Badge +1

I’m also interested in exporting the CSV format file via API, but only because it contains additional data not present in the native JSON format output. 

Specifically I’m looking for the “ContainedBy” information.  If I can get the CSV file I can continue to process this information but ideally I’d like the same information in the Document Contents output.

Userlevel 4
Badge +6

Hi Richard, thanks for your comment. Unfortunately the ContainedBy field you see in the CSV export currently isn’t included by default in the JSON response to a GET Document Contents, so there is no way to tell which shapes are in containers.

However, one way you could work around this is by using the CONTAINED or CONTAINEDBY formula functions in your document. This would allow you to identify which shapes are in which containers from the "customData" part of the JSON response. You can find an example in this Developer Community post, where another user is seeking help with the exact CONTAINED function to use.  

Please feel free to respond with your feedback or a brief description of your use case, especially if this workaround isn’t suitable. We are always looking for ways to improve our public API’s and we value your feedback. 

Reply