New JSON Standard Import API

  • 7 December 2023
  • 10 replies
  • 868 views

Userlevel 3
Badge

Hi Lucid Developers!

🌟 We just launched our JSON Import functionality within the Standard Import API, and it's set to revolutionize the way you create and visualize data in diagrams.

🔍 Why is JSON Import a Big Deal?

  • Simplicity and Power: Compared to other import methods, JSON import is less complicated yet more powerful, making it possible to auto-create detailed diagrams.
  • Fully Automated Workflow: You can now automate your entire diagram creation process more quickly. No need to open Lucid - just set up your JSON, send a request to our Import Document endpoint, and let Lucidchart handle the rest.
  • Ideal for Various Use Cases: Whether you're visualizing complex networks or leveraging AI for diagram creation, JSON import has opened up many new possibilities.

đź‘Ą Who Should Be Excited?

  • Network Professionals: Visualize intricate networks and data centers with ease.
  • AI Enthusiasts: Bring AI-generated diagrams to life quickly.
  • Automation Gurus: JSON import is the perfect option for automating workflows.

We're eager to see the innovative ways you'll use JSON import. Share examples of how you implement this new functionality or ask questions in the thread below this post. 

Looking forward to your creations,

Scott P, Lucid API Team 🚀

P.S. Don't forget to check out the Guides section of Lucid’s Developer Documentation for detailed guidance and tips on getting started on Lucid’s Developer Platform!

 

Jake C 7 months ago

For an example of how to use this new import, check out this Python project I built that imports completed Jira stories for a specified user. Before we had the Standard Import, we had to try to find this information through Jira and manually pull all the Jira tickets into a Lucid document for a user.

However, now that we have the Standard Import, this script can do all of that automatically. All you have to do is input the email of the Jira user, the year you want stories for, and which Lucid product you want to import them into. Then, the Python script will organize the stories by quarter and create a Lucid document for you.

This script has been super helpful for us going into year-end performance reviews so that we can see what work has been completed for each engineer on our team!

View original

Comments

Userlevel 2
Badge

For an example of how to use this new import, check out this Python project I built that imports completed Jira stories for a specified user. Before we had the Standard Import, we had to try to find this information through Jira and manually pull all the Jira tickets into a Lucid document for a user.

However, now that we have the Standard Import, this script can do all of that automatically. All you have to do is input the email of the Jira user, the year you want stories for, and which Lucid product you want to import them into. Then, the Python script will organize the stories by quarter and create a Lucid document for you.

This script has been super helpful for us going into year-end performance reviews so that we can see what work has been completed for each engineer on our team!

Badge

I created a document but page and shape data is getting ignored in my api calls, is there anything I can do to debug? I get a success message on the call. 

Userlevel 2
Badge +3

Hi @jstockwell, thanks for following up in this post! Just to make sure we’re understanding your issue correctly, are you seeing an issue with none of your shapes/pages appearing when you’ve imported your JSON file or are you not seeing Custom shape and page data? Is it possible for you to share the format of your JSON file that corresponds to the issue? 

This will allow us to take a closer look at what you’re experiencing! Thanks!

Badge

thanks, I have tried to copy the example in the JIRA example in the pinned post. I get a new document created with the correct title, but the page doesn’t get renamed and none of the shapes appear. 

 

{
"version": 1,
"rules": [],
"collections": [],
"title": "Main Plan",
"pages": [
{
"id": "page1",
"title": "Main Plan",
"shapes": [
{
"id": "swimlane1",
"type": "swimLanes",
"boundingBox": {
"x": 0,
"y": 0,
"w": 1280,
"h": 155
},
"style": {
"fill": {
"type": "color",
"color": "#ADD8E6"
},
"stroke": {
"color": "#000000",
"width": 2,
"style": "solid"
}
},
"magnetize": true,
"vertical": true,
"titleBar": {
"height": 10,
"verticalText": false
},
"lanes": [
{
"title": "Q1",
"width": 320,
"headerFill": "#ffffff",
"laneFill": "#D3D3D3"
},
{
"title": "Q2",
"width": 320,
"headerFill": "#ffffff",
"laneFill": "#D3D3D3"
},
{
"title": "Q3",
"width": 320,
"headerFill": "#ffffff",
"laneFill": "#D3D3D3"
},
{
"title": "Q4",
"width": 320,
"headerFill": "#ffffff",
"laneFill": "#D3D3D3"
}
]
}
]
}
]
}

 

Badge

Another good resource to use if you want to use the standard import to create BPMN diagrams is this open source script my team and I created. It takes the route to the BPMN/XML file (or entire directory) you want to import, reads it, transforms it into the JSON format the standard import uses, and then makes the request to the API. This is still a work in progress but we are confident on how useful it is in it's current state!

Userlevel 2
Badge

Hi, @jstockwell , thanks for reaching out about the new Standard Import! I’m a developer on the team that built the import and can help you debug what’s going wrong. Me and a few of the engineers on my team just tried the import with the JSON that you sent over above and want to make sure we’re seeing the same thing as you. 

This is a screenshot of the document that we got: 

 

To get that doc:

  1. I created a document.json file with the provided JSON in the post above
  2. Compressed that single file into a zip archive
  3. Renamed the zip archive to have the .lucid extension
  4. And sent a POST request using Postman to the https://api.lucid.co/documents endpoint. Here is a screenshot of the body of the request that I sent so you can check that we’re sending the same thing:

    And here are the headers that I sent on that request:

     

Let me know if this matches what you are seeing and we can debug from there.

Badge

Hi, thanks for following up on this. I realised I’m missing the step of saving the json to a file/lucid document. I was trying to send the page and shape data as part of the body of the api data. I will try again with the file and see if this can resolve it. 

Userlevel 2
Badge

Glad that we were able to find the missing step! Let us know if you have any more questions.

Badge

Hi!

I am trying to use Lucid Standard Import to create a document and I am getting “badRequest” with the following details:

{
"code": "badRequest",
"message": "Bad or malformed request",
"requestId": "6cfdf736169adfd9",
"details": {
"error": "Count: 1, message: Standard import file entry does not exist",
"import_error_code": "invalid_file"
}
}

What should I do to fix it ?

Thanks!

Badge

Hi tuantv, thanks for reaching out! The error you’re seeing matches one that we’ve listed in the troubleshooting section of our documentation for the Lucid Standard Import that can be found here:

https://developer.lucid.co/standard-import/#common-file-errors

It appears that the problem might be happening because you compressed the folder containing your files instead of compressing the files together as a group.

If this isn’t the case, could you share your file structure so we can look into it further?

Reply