By utilizing the REST API, you can connect Wagby with any client (front end application).

The Wagby application supports the REST API as standard.

When a developer sends an HTTP request to the server (host) on which the Wagby application is running, it can acquire the result in the JSON format.

Using this mechanism, it is possible to perform database operations such as acquisition, registration, update, and deletion of data stored in Wagby from a dedicated front-end application using HTTP request.It can be accessed not only from PC but also from iOS and Android OS.

It shows a typical API.Details are listed on each page.

URL HTTP method Description
/rest/session PUT Log on
/rest/session DELETE log off
/rest/session GET Retrieve logon user information
/rest/[model name]/list GET Obtain list display data
/rest/[model name]/list POST Specify search conditions to acquire data
/rest/[model name]/entry/[primary key] GET Retrieve the data specified with the primary key
/rest/[model name]/new GET Start new registration of data
/rest/[model name]/new POST Execute new registration of data
/rest/[model name]/edit/[primary key] GET Start updating the data specified by the primary key
/rest/[model name]/edit/[primary key] PUT Perform data update specified by primary key
/rest/[model name]/edit/[primary key] DELETE Delete data specified with primary key

In this guide, we use the notation called RequestMapping.

@RequestMapping(value="/rest/session", method=PUT)

The notation

http://localhost:8921/wagby/rest/session

Into

method=PUT

Indicates that you want to access with.

Also

produces="application/json"
Notation in the HTTP header

Accept:application/json

Indicates that you want to set.

Even when using the REST API, there is a danger that logon information and data will be eavesdropped unless the communication path is encrypted, as with ordinary web applications.

For this reason, please use HTTP encrypted communication (HTTPS) in actual operation.Specifically, I will purchase a "server certificate".Since the Wagby application is based on Tomcat, it can be set by the same procedure as registering a server certificate to Tomcat.(For details, please contact the publisher of "server certificate" or Wagby sales partner.)

There are two versions of the REST API.

Version 1 (former method)

It is a format up to R 7.10.3.The key name of JSON object is Camel Case format.

For example, for item name "user_address", the key name of the JSON object is "userAddress".

With Wagby R8, Version 1 is obsolete.

Version 2 (standard method)

It was added in R 7.11.Output the key name of the JSON object from CamelCase format and the item name as it is.

For example, for item name "user_address", the key name of the JSON object is also "user_address".

Select version

In Wagby after R7.11, the standard is "version 2".If you use "version 1" for some reason, please do the following.

Specify in the whole application (deprecated)

"REST API Version" of "Environment> Customize> Details" is set to "v1".When it is blank, it becomes v2.The default is blank (v2).

Figure 1 Specify by application as a whole
Since this method makes it difficult to migrate to R8 in the future, we recommend that you restrict v1 to be used only when it is inevitable in the "Specification by model" explained below.

Designate by model

Let "REST API Version" of "Screen> Other> REST" be "v1".When it is blank, it becomes v2.The default is blank (v2).

Figure 2 Specifying by model

Specify the version when calling

You can specify the HTTP header X - Wagby - RESTAPIVersion: v1 when using the REST API.In this case, even if the REST API Version of the model is v2, v1 can only be used for this access.If you need to use v1 but you do not want to change the model definitions, please use this method.

You can also change the handling of the JSON object's key name to the new method (without using Camel Case) and specify the HTTP header X-Wagby-RESTAPIVersion: v2.In this case, all REST API accesses are new methods.

Version 2 only model

The portlet and modern calendar view internally use the REST API, but after R7.11 we only handle v2.(It is not possible to return to v1.)

It can not be called together with processing in the screen

It can not be used for customization such as calling REST API together with Wagby screen processing.

For example, using JavaScript, you can not customize such as calling the REST API within the list update screen.

Can not be combined with Activie Directory/Open LDAP

Active Directory and Open LDAP etc authenticate via CAS.The REST API does not support this CAS authentication.(It is planned to correspond in the future Wagby.Please wait for a while.)