Accessing the Elsevier Article Retrieval API from .NET

During the COVID-19 outbreak a lot is written on Open Research and Open Access to journals, so that the research throughout the world is stimulated by removing journal paywalls and subscription fees.

According to Wikipedia Open Access is ...

... a set of principles and a range of practices through which research outputs are distributed online, free of cost or other access barriers. With open access strictly defined (according to the 2001 definition), or libre open access, barriers to copying or reuse are also reduced or removed by applying an open license for copyright.

Elsevier, which is one of the largest publishers in scientific, technical, and medical content, also has dedicated some of its resources to Open Science:

I wanted to learn how to use the Elsevier Article (Full Text) Retrieval API to get Open Access articles in a structured form, that it could be used for further data analytics.

The Elsevier developer portal has a good documentation on its APIs:

There was no .NET Client to query the Article Retrieval API, so I wrote the ElsevierFulltextApi library.

Usage

// Copyright (c) Philipp Wagner. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.

using NUnit.Framework;
using System.IO;
using System.Threading.Tasks;

namespace ElsevierFulltextApi.Test
{
    [TestFixture, Explicit("This Test requires a valid Elsevier API Key")]
    public class TestModelDeserialization
    {
        [Test]
        public async Task RunTestAsync()
        {
            // Read the Elsevier API Key from a File, so it isn't hardcoded here:
            var apiKey = File.ReadAllText(@"D:\elsevier_api_key.txt");

            // ... then create the API client using the API Key:
            var client = new ElsevierFulltextApiClient(apiKey);

            // ... query the Article API for a DOI:
            var fullText = await client.GetArticleByDOI(@"10.1016/j.adro.2019.05.007");

            // ... make sure it has been converted:
            Assert.IsNotNull(fullText);

            // ... work with your data:
            var creators = fullText.Coredata.Creators;

            Assert.IsNotNull(creators);
            Assert.AreEqual(13, creators.Count);
        }
    }
}

License

The code is released under terms of the MIT License.

How to contribute

One of the easiest ways to contribute is to participate in discussions. You can also contribute by submitting pull requests.

General feedback and discussions?

Do you have questions or feedback on this article? Please create an issue on the GitHub issue tracker.

Something is wrong or missing?

There may be something wrong or missing in this article. If you want to help fixing it, then please make a Pull Request to this file on GitHub.