Using Postman REST Client with Mendeley.

Chrome has a fantastic array of apps that you can use to help you with your development and one such app is called Postman. This is a free tool that allows you to quickly test out REST APIs and store a collection of requests so that you can build up little workflows of API calls.

I thought I would show you how you could use it with the Mendeley API. I’m using the (Packaged App) version for this post.

Before you proceed with this demo you will need to register for an API key on the Mendeley developer portal.   You will need to set the ‘redirect_url’ to https://www.getpostman.com/oauth2/callback 

Once you have this installed then on the landing page you will see some headings and among those headings is OAuth 2.0 

empty-oauth-page

Click on the OAuth 2.0 tab on the top and you will see a screen like above and fill in the fields:

  1. Authorization URL = https://api.mendeley.com/oauth/authorize
  2. Access Token URL = https://api.mendeley.com/oauth/token
  3. Client ID = <your-client-id>
  4. Client Secret = <your-client-secret>
  5. Scope = ALL

Now click the ‘Get Access Token’ button. You will be presented with the Mendeley login screen so just login.

Once you have done all that then you should see a screen like this one here. This is your access token details that will be used against all the requests. Mendeley access tokens expire and will need refreshing after 1 hour. Now save your OAuth details with a name such as ‘mendeley-postman-test’. 

access-token

Now you have gotten over the OAuth 2.0 hurdle you can begin to make some requests.

  1. Find the input box that says ‘Enter request URL’ and enter ‘https://api.mendeley.com/documents
  2. Click on the ‘Add token to header’ radio button
  3. Click the Headers button on the right
  4. Find the input box that says ‘Header’ and begin to type Authorization and select it from the list.
  5. Then for the value field you click on the saved OAuth details that we named mendeley-postman-test. This should fill in your Bearer details like below.

adding-header-screen-shot

Click on the Send button and you should see a JSON response of all the documents in your library.

last-screen-shot

This is a simple example of how you can start your Mendeley Collection using Postman.

 

This entry was posted in Uncategorized on by .

About Joyce-Stack - Developer Outreach

Joyce Stack completed a BSc. (Hons) Computer Science from The Open University while working in a startup in Co. Cork, Ireland. She moved to London in 2005 to join one of the City’s leading exponents of agile techniques at that time to work as a Java Developer. She is now working in the Developer Outreach role in Mendeley where her responsibilities are to meet and educate developers about the Mendeley API, attend conferences, meetups and hackathons and basically be the face of the API. She is passionate about providing an excellent developer experience and APIs. She likes biking, swimming and yoga but she hates potatoes despite being Irish.