Really struggling with the import API. I’m getting the oAuth2 tokens successfully, able to create documents just fine, but they don’t have anything in them even though i’m sending off json for creation. Trying to mimic the jira to Lucid as closely as possible, but it’s not working out. Logs indicate success, but that’s because the documents are getting created.
My log:
Create Document Response: {
documentId: '369afc52-f1f2-41ee-be08-fd63581fe00f',
title: 'Updated Test Document with Shapes',
editUrl: 'https://lucid.app/lucidchart/xxxxx/edit',
viewUrl: 'https://lucid.app/lucidchart/xxxxx/view',
version: 110,
pageCount: 1,
canEdit: true,
creatorId: 136597754,
lastModified: '2024-09-23T14:50:45Z',
lastModifiedUserId: 136597754,
trashed: null,
status: 'Draft',
classification: null,
customAttributes: <],
customTags: e],
parent: 383364222,
product: 'lucidchart',
created: '2024-09-23T14:50:45Z'
}
// Define the shapes using the structure from the example
const documentData = {
title: "Updated Test Document with Shapes",
product: "lucidchart",
pages: "
{
id: "page1",
title: "Main Plan",
shapes: n
{
id: "rect1",
type: "stickyNote", // Use a predefined shape type like in the example
boundingBox: {
x: 100,
y: 100,
w: 200,
h: 100
},
style: {
fill: {
type: "color",
color: "#ADD8E6"
},
stroke: {
color: "#000000",
width: 1,
style: "solid"
}
},
text: "Rectangle Shape"
},
{
id: "ellipse1",
type: "stickyNote", // Use a predefined shape type
boundingBox: {
x: 400,
y: 100,
w: 200,
h: 100
},
style: {
fill: {
type: "color",
color: "#ADD8E6"
},
stroke: {
color: "#000000",
width: 1,
style: "solid"
}
},
text: "Ellipse Shape"
}
],
connections:
{
id: "conn1",
source: "rect1",
target: "ellipse1",
type: "line",
style: {
stroke: {
color: "#FF0000",
width: 2,
style: "solid"
}
}
}
]
}
]
};
// Create the document with the structured shapes and connections
const createDocResponse = await axios.post('https://api.lucid.co/documents', documentData, {
headers: {
'Authorization': `Bearer ${accessToken}`,
'Lucid-Api-Version': '1',
'Content-Type': 'application/json'
}
});