Access data to react frontend UI from REST URI

Hello,
I have created cuba application with spring boot as a backend .
I need to access the data in react frontend UI from REST URI Designed in spring boot.
I created the frontend UI and added data collection:
dataCollection = collection(System.NAME, {
view: “someData”,
sort: “-updateTs”
});
but I am unable to understand how to get the data from my REST URI.

Hello @sahilvichare47,

You can see an example here.

Hi @v.pushkin
In generic UI I have set the data container with the json data using the REST URI as below:

CloseableHttpClient httpClient = HttpClients.createDefault();
HttpGet httpGet = new HttpGet(“http://localhost:8081/api/v2/alldom”);
try (CloseableHttpResponse response = httpClient.execute(httpGet)) {
json = EntityUtils.toString(response.getEntity());
System.out.println("JSON Domain: "+ json);
} catch (IOException e) {
throw new RuntimeException(e);
}
return json;

Similarly how can I set the data in collection function of DataCollectionStore in REACT UI?

I’ve just noticed you mentioned using Sprint Boot as backend. I think it doesn’t bring much value to use CUBA frontend together with a custom backend that is not CUBA, because it relies on features implemented on CUBA’s backend side, specifically Generic REST API addon.

You might be interested in looking into Jmix, which is a new generation of CUBA Platform. Jmix uses Spring Boot as it’s backend technology instead of “pure” Spring used by CUBA.

1 Like

Thanks for your suggestion sir !