Custom aggregated query with spring boot data REST - spring

I'm pretty new to Spring Boot and Spring Data Rest and HATEOAS. I'm able to create a REST API with CRUD capability on an entity (say Device, entity having a few properties, including one called manufacturer), and interact with the API (get/add/update/delete/patch device) "out of the Spring Boot box".
I now want to call an API endpoint to get an aggregated view of the device repository that, in short, returns the result of the query select manufacturer, count(*) from devices group by manufacturer. Is this doable with spring data rest or it needs to be done with JPA? or should I define a specific entity having these two fields (device_manufacturer, count)?
Thanks

Related

Use GraphQL with in existing spring boot rest api

We have few existing rest apis written in spring boot to fetch different data in our project? Now we are exploring options to use GraphQL. But we don't want rest endpoints & response to change since it is being consumed by many UI/backend applications. Can anyone suggest proper way to use GraphQL within existing API without changing rest endpoints and Response type?

How to fetch data in Spring Boot from table of Angular7

I created data table in angular and taking order input from customer. Customer will enter order data and click on submit. What I want that when customer will click on submit button that time this order data will be send to the my spring boot application and print.
How can I fetch this data in spring boot and display using get and post method? I am new to Angular and Spring Boot.
You can take a reference from below link how to create API in spring boot and how to call it from angular.
https://www.devglan.com/spring-boot/spring-boot-angular-example
When you send a array list data from angular to spring boot using post method then in spring boot you can receive same array list using post method not get method..

Spring Rest dummy API implementation based on the user ID

We have a restful API having only basic filters with no spring security features like role,principal etc.,. Lets say there is an API end point /User/{ID}/BankAccounts
We would want to have a dummy user ID for testing purposes where the data would be mocked for an ID "123" and the actual API implementation for the rest of the users.
API structure is a collection of rest controllers, (have about 15) calling DB/WS.
We do not wish to make change on each controller but to do it at a centralized point.

Spring REST service with third party api as a datasource

I need to expose REST service which as a datasource gets data returned from third party api calls, instead of regular DB.
I'd like to have all the benefits of the Spring Data Rest, but I don't know what I really need as my dependency, since I'm not using JPA.
Basicaly, how my model (Entity?) should be implemented to have the functionalities (like, paging, sorting...).
What Spring framework dependencies should I choose.
Or possibly I'm overlooking something here and for such requirement is another path.
Thanks.

Spring JPA with Jersey

I am writing a rest service using Jersey. The data access layer will be developed using Spring JPA. I will be interested to know how can I pass database properties to the Repository layer.
take a look at #Blaise Doughan's answer to a similar question
How to insert data from database with Web Service in java using JAX - RS

Resources