Given a document ID, the metadata about that document can be obtained. The signed OAuth headers are required to make this call. The call will return an HTTP status 200 if it succeeded with a response that is an XML document.
<?xml version="1.0" ?> <documents> <document> <documentId>4df67392-0894-44ad-987e-6ab30a2e3afb</documentId> <title>Mockup #1</title> <editUrl>https://app.lucidchart.com/documents/edit/4df67392-0894-44ad-987e-6ab30a2e3afb</editUrl> <viewUrl>https://app.lucidchart.com/documents/view/4df67392-0894-44ad-987e-6ab30a2e3afb</viewUrl> <version>220</version> <pageCount>3</pageCount> </document> </documents>
If an error occurs, an appropriate HTTP response code will be returned (non-200) and response body will be XML.
<error> <status>401</status> <message>Access Denied</message> </error>
To edit a document, the user must be sent to the Lucidchart editor. The document meta data contains an "editUrl" that the user can be directed to in order to edit their document. A third party can add to the editUrl a query param that will cause a button to appear in the editor with a link back to their application. Both an app and callback need to be provided and the callback should be URL encoded.
For example, assume the editUrl for a document is:
OAuth params can also be added to this URL (see "Display the Lucidchart document list" for a description of how to add OAuth params).
To send the user to the Lucidchart editor with a return button to the example application, the user would be redirected to:
To create a document directly (not through the documents list), the user must be sent to the Lucidchart editor. A third party can send a user to the newDoc endpoint which will open the Lucidchart editor with a new document and cause a button to appear with a link back to their application. A callback needs to be provided and the callback should be URL encoded. OAuth params should also be added to this URL (see "Display the Lucidchart document list" for a description of how to add OAuth params).
The URL to redirect the user to has the form:
https://app.lucidchart.com/api/newDoc?callback=<your callback>&oauth_signature=<oauth signature>&oauth_version=1.0&oauth_nonce=<nonce>&oauth_signature_method=HMAC-SHA1&oauth_consumer_key=<consumer_key>&oauth_token=<token>&oauth_timestamp=<timestamp>
The user will be brought to a new document in the editor and "return to <app name for oauth key>" will be displayed. As with the edit endpoint, the callback will be called when the user clicks the button and the query param documentId will be added to the callback URL so the app at the callback has the ID of the document that was created.