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.
Once you have this installed then on the landing page you will see some headings and among those headings is OAuth 2.0
Click on the OAuth 2.0 tab on the top and you will see a screen like above and fill in the fields:
- Authorization URL = https://api.mendeley.com/oauth/authorize
- Access Token URL = https://api.mendeley.com/oauth/token
- Client ID = <your-client-id>
- Client Secret = <your-client-secret>
- 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’.
Now you have gotten over the OAuth 2.0 hurdle you can begin to make some requests.
- Find the input box that says ‘Enter request URL’ and enter ‘https://api.mendeley.com/documents’
- Click on the ‘Add token to header’ radio button
- Click the Headers button on the right
- Find the input box that says ‘Header’ and begin to type Authorization and select it from the list.
- 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.
Click on the Send button and you should see a JSON response of all the documents in your library.
This is a simple example of how you can start your Mendeley Collection using Postman.