mirror of
https://github.com/ItsDek/sensor-api.git
synced 2026-08-30 10:59:12 +00:00
Add POST endpoint for measurement creation
This commit is contained in:
@@ -10,6 +10,10 @@ import dev.deklab.model.Measurement;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.ResponseStatus;
|
||||
|
||||
|
||||
@RestController
|
||||
public class MeasurementController {
|
||||
@@ -33,5 +37,11 @@ public class MeasurementController {
|
||||
}
|
||||
throw new ResponseStatusException(HttpStatus.NOT_FOUND);
|
||||
}
|
||||
@PostMapping("/measurements")
|
||||
@ResponseStatus(HttpStatus.CREATED)
|
||||
public Measurement postMeasurement(@RequestBody Measurement measurement) {
|
||||
return measurement;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user