Skip to main content

REST APIs Customize

Low-Code Customize & Extend - REST APIs

tip

For corresponding details, Please refer to Resources page for locating Github and Videos Learn, Videos, Tutorials

Backend (BE): Low-Code Customize & Extend

This section contains guides to low-code customize REST APIs.

REST Low-Code Customize

  • Implement DataMesh with data from repository or other endpoints REST, GraphQL.

Customize - How Tos ?

Implement Data Federation | Data Mesh

Create Data Federation | Data Mesh with any custom combination, for all of your data.

Provide a unified REST API endpoint that includes data from any of:

  • A. REST API function in project
  • B. Any other REST API endpoint

A default DataMesh Query is provided in generated code. That can be easily customized further. Tip: Get code block to fetch REST endpoint from respective auto-generated REST controller.

See Code Example

 // Data Mesh Sample Code: Combine / Fetch the data from other REST sources 

/*
Code-Help [CH] : Enable DataMesh Sample by steps below -
1-Uncomment Imports Required For Data Mesh
2-Uncomment Function Below
*/

/*
// -------------------- DataMesh -------------------------

@GetMapping("erp_product/DataMesh")
public ResponseEntity<List<ErpproductTblRec>> ErpproductTblRecDataMesh()
throws Exception
{
try {
List<ErpproductTblRec> ErpproductTblRecList = new ArrayList<ErpproductTblRec>();

ErpproductTblRec1Repository.findAll().forEach(ErpproductTblRecList::add);

System.out.println("Data Mesh Source #1 Record Count: "+ErpproductTblRecList.size());

// ---- Combine Data With ----------------------------------------------------
// Get data from REST API call (sample shows getting data from same table ViewAll API call)
//----------------------------------------------------------------------------
String get_data_rest_url = "http://127.0.0.1:9080/emdbrest/erp_product/ViewAll?pageNo=-1"; //-1 == Unpaginated
WebClient webClientRest = WebClient.builder().baseUrl(get_data_rest_url)
.defaultHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON_VALUE).build();

Mono<List<ErpproductTblRec>> responseRest =
webClientRest.get()
.header(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON_VALUE).retrieve()
.bodyToMono(new ParameterizedTypeReference<List<ErpproductTblRec>>() {});

List<ErpproductTblRec> getMeshRestListErpproductTblRec = responseRest.block();

System.out.println("Data Mesh Source #2 Record Count: "+getMeshRestListErpproductTblRec.size());

getMeshRestListErpproductTblRec.forEach(ErpproductTblRecList::add);
//----------------------------------------------------------------------------

if (ErpproductTblRecList.isEmpty()) {
return new ResponseEntity<>(HttpStatus.NO_CONTENT);
}

return new ResponseEntity<>(ErpproductTblRecList, HttpStatus.OK);
} catch (Exception e) {
System.out.println("Error: Exception: "+e.getMessage());
//e.printStackTrace(System.out);
return new ResponseEntity<>(null, HttpStatus.INTERNAL_SERVER_ERROR);
}
}
*/