restQL-core-java alternatives and similar libraries
Based on the "HTTP Clients" category.
Alternatively, view restQL-core-java alternatives based on common mentions on social networks and blogs.
-
Armeria
Asynchronous RPC/REST client/server library built on top of Java 8, Netty, HTTP/2, Thrift and gRPC. -
Google HTTP Client
Pluggable HTTP transport abstraction with support for java.net.HttpURLConnection, Apache HTTP Client, Android, Google App Engine, XML, Gson, Jackson and Protobuf. -
Apache HttpComponents
A toolset of low level Java components focused on HTTP and associated protocols.
Scout APM: A developer's best friend. Try free for 14-days
* Code Quality Rankings and insights are calculated and provided by Lumnify.
They vary from L1 to L5 with "L5" being the highest. Visit our partner's website for more details.
Do you think we are missing an alternative of restQL-core-java or a related project?
README
restQL-core-java
restQL-core allows you to run restQL queries directly from JVM applications, making easy to fetch information from multiple services in the most efficient manner. e.g.:
from search
with
role = "hero"
from hero as heroList
with
name = search.results.name
You can learn more about restQL query language here and here
restQL-core is built upon the battle proven HttpKit and Clojure core.async to maximize performance and throughtput.
If you're using Clojure you may want to check restQL-core or restQL-Server if you're using another languagem or working in a client application.
Getting Started
Installation
Add Clojars repository and restQL dependency to your project
Maven
<repositories>
<repository>
<id>clojars.org</id>
<url>http://clojars.org/repo</url>
</repository>
</repositories>
...
<dependency>
<groupId>com.b2wdigital</groupId>
<artifactId>restql-core-java</artifactId>
<version>3.5.5</version>
</dependency>
Gradle
repositories {
maven {
url "http://clojars.org/repo"
}
}
...
compile 'com.b2wdigital:restql-core-java:3.5.5'
First query
ClassConfigRepository config = new ClassConfigRepository();
config.put("planets", "https://swapi.co/api/planets/:id");
RestQL restQL = new RestQL(config);
QueryResponse response = restQL.executeQuery("from planets with id = ?", 1);
System.out.println("The response JSON is: " + response.toString());
In the example above restQL will call StarWars planet API passing "1" as param.
Configuration
restQL receives a configuration class with the API mappings. You can use the available configuration repositories -- SystemPropertiesConfigRepository
, PropertiesFileConfigRepository
or ClassConfigRepository
-- or implement your own, using the ConfigRepository
interface.
You can check more about endpoints configuration here
Examples
Simple Query
Retrieving all magic cards
ClassConfigRepository config = new ClassConfigRepository();
config.put("cards", "http://api.magicthegathering.io/v1/cards");
RestQL restQL = new RestQL(config);
String query = "from cards as cardslist params type = ?";
QueryResponse response = restQL.executeQuery(query, "Artifact");
// The JSON String
String jsonString = response.toString();
// The mapped object
List<MTGCard> cards = result.getList("cardslist", MTGCard.class);
Chained Query
Listing all cards and then fetching its details.
ClassConfigRepository config = new ClassConfigRepository();
config.put("cards", "http://api.magicthegathering.io/v1/cards");
config.put("card", "http://api.magicthegathering.io/v1/cards/:id");
RestQL restQL = new RestQL(config);
String queryCardsAndDetails = "from cards as cardsList params type = ? \n"
+ "from card as cardWithDetails params id = cardsList.id";
QueryResponse response = restQL.executeQuery(queryCardsAndDetails, "Artifact");
// The JSON String
String jsonString = response.toString();
// The mapped object
List<MTGCard> cards = result.getList("cardWithDetails", MTGCard.class);
Building From Source Code
As prerequisites to build restQL from source we have:
- Java 11
- Maven 3
Just clone this repo and run "mvn compile".
License
Copyright © 2016 B2W Digital
Distributed under the MIT License.
*Note that all licence references and agreements mentioned in the restQL-core-java README section above
are relevant to that project's source code only.