Mendeley Desktop (or simply: Mendeley) is powerful reference manager. It’s not open-source, like Zotero, but polite and nice kind of free software: no nasty catches nor tricks. It has plenty of features that made me loyal user, trying but never actually migrated to Zotero. However, the software is not actual topic of this post, but its unofficial http API server. Initially, I found wrong StackOverflow answer on (non) existance of Mendeley Desktop API. Could be it was truth some time ago, but: there is API via HTTP. As StackOverflow user chiastic-security pointed out: it is not supposed to be a public API and there is no official support for it, but I prefer to see it as a glass that is full to the half, not empty to the half :).
So, how to access it. Start your Mendeley Desktop manager, and open:
Well, what we have here: self-generated HTML interface to the server/service that is actually consumed by Word/LibreOffice/OpenOffice Mendeley extensions. (btw. officially only LibreOffice extension is supported, but it will work fine with OpenOffice before v4. OpenOffice 4 changed its way the extensions describe their toolbar GUI so, to make it work you really need to dig into the code)
On the quick look to the list, you get basic idea what is what. If you open a link and you’ll get an web form interface to test your queries. To call commands you can use GET or POST parameters in HTTP request with client instance of choice.
Now, to figure out how to actually make use of the API, I suggest you dig into OpenOffice / LibreOffice Mendeley extension (macro) source code.
Or if you are better friend with Python then Basic (like my self), check in your Mendeley Desktop installation folder or other location where you have OpenOffice extension package for MendeleyDesktopAPI.py script. In my case I found it in:
C:\Program Files (x86)\Mendeley Desktop\openOfficePlugin\Mendeley-1.17.11\Scripts
In the file you should get some ideas how it works, i.e. how JSON request body should look.
# simplejson is json # simplejson is json (using a generic 'except' and not 'except ImportError' # because MD-19770. See https://bugs.launchpad.net/ubuntu/+source/libreoffice/+bug/1222823 try: import simplejson as json except: import json # For communicating with the Mendeley Desktop HTTP API class MendeleyHttpClient(): HOST = "127.0.0.1" # much faster than "localhost" on Windows # see http://cubicspot.blogspot.com/2010/07/fixing-slow-apache-on-localhost-under.html PORT = "50002" CONTENT_TYPE = "application/vnd.mendeley.wordProcessorApi+json; version=1.0" lastRequestTime = -1 def __init__(self): self.previousResponse = self.Response(200, None, None, None)
I wrote this post as response to a StackOverflow comment/question to elaborate my initial idea how the API may be consumed.
Note: I made zero actual tests with this, and have no idea how JSON should look. Here are just few ideas/directions where to look. Once I figure out some practical use, and make some tool – I’ll update this post with newer findings/directions.
Mendeley Desktop is based on Qt Web Engine Application platform
Thus, by calling the exe with –remote-debugging-port=<port number> argument:
- will enable logging at QtWebEngine server