Demonstration of how you can use the abas REST API.
A Java Development Kit version 8 is needed. All further java dependencies (libraries needed at compile time and at runtime) are managed and downloaded automatically by Gradle.
Eclipse is our IDE of choice but this project doesn’t stick to it.
Simply use
./gradlew eclipse
to generate Eclipse project and classpath files. If you want to use another IDE, feel free to apply
another plugin in build.gradle
in the projects' directory.
Currently, there are three small projects demonstrating how you can use aspects of the abas REST API.
Uses groovyx.net.http.RESTClient
to send HTTP
requests to the RESTful web services. The connection is established in
de.abas.restapi.client.Utils#createClient()
. Find and modify connection properties there.
There are two examples in this project:
Searches at most 1000 products (objects in obj/data/2:1
) with search words between M
and N
and
prints fields nummer
, such
, sucherw
, the object’s rowCount
and its location.
Creates a new opportunity (object in obj/data/3:30
) within the user’s workspace using filters for head
and table fields. Then it sets some field values, inserts a row and prints the result. Next, the editor
is committed and the corresponding working set is closed. Finally the URL for the now "latest-version" is
printed.
The example makes use of HATEOAS to find the right resources for all state transitions. Only the initial URL for creating the opportunity is hard-coded.
Uses com.jayway.restassured.RestAssured
Java API to send HTTP
requests to the RESTful web services and parse the responses.
There is just a small main()
method in de.abas.restapi.client.RestAssuredClient
that demonstrates how you
can query customers using the RestAssured client API.
Uses the RESTEasy Client Framework to create client-side Java proxies for a customer object and a list of customers. For parsing the responses JsonPath is used.
The main class is de.abas.restapi.client.RestEasyClient
. Here, the connection is established and the results
are printed. The entry URL and HTTP methods are defined in de.abas.restapi.client.Customers
using javax annotations.
Model classes in package de.abas.restapi.client.model
define which fields are queried and where their values
can be found within the response’s JSON structure.
Like the ResteasyClient this small application uses the RESTEasy Client Framework to create client-side Java proxies.
To run the JavaFX User Interface follow these steps:
-
Enter your connection data into:
src/main/java/de/abas/restapi/client/ConnectionData.java
-
Choose your language in:
src/main/java/de/abas/restapi/client/I18N.java
by setting the constantLANG
an appropriate value -
Run the application:
./gradlew ProductFX:run