The universal JPA web API enables to load and save any entities defined in the application data model by sending simple HTTP requests.
This provides an easy way to integrate with a wide range of third-party applications – from the JavaScript code executed in the browser to arbitrary systems running on Java, .NET, PHP or any other platform.
Key API features:
- Loading entity instances from the database by identifier or by JPQL query with parameters.
- Saving new and modified instances, deleting instances.
- Obtaining a description of the data model in HTML format.
- Data representation in JSON and XML formats.
- Middleware service calls.
- User authentication.
Read addon Wiki for additional information.
You can install the add-on by coordinates choosing the required version of the add-on from the table.
In case you want to install the add-on by manual editing or by building from sources see the complete add-ons installation guide in CUBA Platform documentation.
- Open your application in CUBA Studio. Check the latest version of CUBA Studio on the CUBA Platform site.
- Go to CUBA -> Marketplace in the main menu.
- Click the icon in the upper-right corner.
- Paste the add-on coordinates in the corresponding field as follows:
com.haulmont.addon.jpawebapi:jpawebapi-global:<add-on version>
where <add-on version>
is compatible with the used version of the CUBA platform.
Platform Version | Add-on Version |
---|---|
7.1.X | 1.0.0 |
- Click Install and apply the changes. The add-on will be installed to your project.
After that the JPA Web API functionality will be available at:
{host:port}/app/dispatch/api/*
- for Web module{host:port}/app-portal/api/*
- for Portal module
JPA Web API URL can be customized via jpawebapi.mapping.url
app property both for web
and portal
application modules.
- Login as
admin / admin
withGET
request:
https://localhost:8080/app/dispatch/api/login?u=admin&p=admin&l=ru
- Load
Users
list using auth token:
https://localhost:8080/app/dispatch/api/query.json?e=sec$Role&q=select+r+from+sec$Role+r&s=b376f1d2-15d7-ea33-4048-2199de9721e7