I was snooping around on GitHub a few weeks back looking for repositories that have used the Mendeley API. I was surprised by how many I found. Unfortunately, some are obsolete and no longer work.
I did find one gem though called GraphQL-Mendeley. GraphQL is a query language that allows client developers to easily ask for data from a server. It was built by Facebook and came about when they were rewriting their mobile clients. Primarily it allowed product developers to be able to build things quickly and easily by providing a consistent query language. Think about how large the Facebook data lake is. Developers could now be selective in exactly what data they required. You are no longer constrained by some pre-determined server view that an API provides. You can execute one network call and be very precise about what you want or you can or you can be greedy and for multiple unrelated objects in one call.
REST APIs do have overheads in that writing APIs is notoriously difficult and writing a good one that fit your product needs, is easy to evolve and services multiple clients is just downright hard.
GraphQL is independent of platforms and data sources so you can run queries using your favourite languages and platform rather easily. It’s not concerned with preparing data for parsing or having to write lots of code to merge multiple unrelated datasets. It’s almost like an API but for data and a lot less complicated.
Researchers often work with data that is flat and unstructured. I could see benefits for organisations who have large datasets (like us) in providing the data via GraphQL so clients can just ask for the data they need.
Checkout the GitHub example and run it for yourself. Below you will see a screenshot of a query that I ran to find the name of people in the group identified with id ‘e3630413-abd9-3308-8937-c5f119c17a28’
If you had to do this using from code and consuming the APIs that we currently have then you would first make a call to Groups such as:
This returns the following JSON response.
Your code would then have to parse the JSON, iterate over the response and for each of the profile ids you would make a call to Profiles to retrieve the id and name details:
Writing less code is always a good thing so it’s going to be interesting to see how this gets adopted.
On a site note we love to see what cool things you build with the Mendeley API. Please get in touch and let me know what you have done. We are working to get external libraries and projects listed on our developer portal – email email@example.com.