Skip to content

abassoftware/abas-rest-api-demo-clients

Repository files navigation

abas REST API Demo Clients

Demonstration of how you can use the abas REST API.

Prerequisites

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.

Generate Eclipse Project

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.

Build

The task

./gradlew build

downloads all external dependencies and compiles all projects.

The Example Projects

Currently, there are three small projects demonstrating how you can use aspects of the abas REST API.

GroovyRESTClient

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:

ListProducts

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.

CreateOpportunity

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.

RestAssuredClient

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.

ResteasyClient

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.

ProductFX

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 constant LANG an appropriate value

  • Run the application: ./gradlew ProductFX:run

Usage:
  • Enter a product number and press TAB (or use a barcode scanner)

  • The product information will be loaded from the abas REST API

About

Demonstration of how you can use the abas REST API

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published