A Java client for the CORE API, based on Retrofit 2.
CORE’s mission is to aggregate all open access research outputs from repositories and journals worldwide and make them available to the public. In this way CORE facilitates free unrestricted access to research for all. We are currently making available 70 million of research outputs metadata and 7 million full text papers. We are looking for devs, designers, data scientists enthusiastic about facilitating the access to research to the world.
This repository is one of our project for the Mozilla Global Sprint '17.
-
Add the JitPack repository to your build file
<repositories> <repository> <id>jitpack.io</id> <url>https://jitpack.io</url> </repository> </repositories>
-
Add the dependency
<dependency> <groupId>com.github.oacore</groupId> <artifactId>oacore4j</artifactId> <version>v1.0.0</version> </dependency>
A full Swagger documentation is available at https://core.ac.uk/docs, while you can find a usage example here. Pull requests and feedback through the issues panel are highly encouraged and appreciated.
We defined a small workflow process to implement further methods in the client. These steps are suggestions, but it should help :)
-
Create a retrofit-like method in a Retrofit-like interface. For example to map a request on the API like:
GET /articles/get/{coreId}
The Retrofit interface definition will be:
Call<Article> getArticleById(@Path(CORE_ID) Integer coreId, @QueryMap Map<String, Object> options);
-
If you need to generate any Java Object to handle request or response, we suggest you to get a complete JSON object from the API (you need a valid CORE article ID? Use 42) and then submit it to jsonschema2pojo using the Jackson 2.x annotation style. You should be able to generate a POJO (nearly) ready to be used in the client.
-
Write tests for it, you can find some tests examples here. To run them locally, just type:
mvn test -DapiKey={YOUR_API_KEY}
Help us making the scientific world openly accessible by everyone!