Linked Questions

Popular Questions

I was instructed to create webservices ( with Spring-Boot ). My colleague gave me the url of the webservice and it looks like this :

In general we create a RestController with the url :

public class StockController {

    private StockService stockService;

    @GetMapping(value = "/{code}", produces = "application/json")
    public JsonModel getByCode(@PathVariable String code) {
        JsonModel jsonModel = new JsonModel();
        final Map<String, Object> data = new HashMap<>();
        List<Stock> stock = stockService.getByCode(code);
        data.put("stock", stock);
        data.put("stockTotal", stockService.getTotal(code));

        return jsonModel;

So is it normal to create a Restful Spring-Boot webservice with a parameter in the url ?

Related Questions