Sobes.tech
Junior — Middle

Were REST API principles applied in your last project?

sobes.tech AI

Answer from AI

Yes, my last project applied REST API principles. We built a service that provided access to data via HTTP requests using standard methods: GET for retrieving data, POST for creating, PUT/PATCH for updating, and DELETE for deleting.

Example:

// Example controller in Spring Boot
@RestController
@RequestMapping("/users")
public class UserController {

    @GetMapping("/{id}")
    public User getUser(@PathVariable Long id) {
        // Retrieve user by id
    }

    @PostMapping
    public User createUser(@RequestBody User user) {
        // Create a new user
    }

    // Other methods for PUT, DELETE
}

We also used clear URLs, HTTP status codes, and JSON for data exchange, which aligns with REST principles.

Were REST API principles applied in your last… - sobes.tech