1

I've created a repository using Spring Boot.

public interface JobRepository extends JpaRepository<Job, Long> { } 

All of the basic CRUD operations work fine. This includes GET, POST, PUT, and DELETE.

When I issue a POST request it adds the Job correctly. The problem is that I want to immediately do something with the ID or URL for that newly created Job. I was hoping that the response to the POST request would contain some sort of unique identifier but it doesn't. The status is "201 Created" and the response body is empty.

Is there a way with the Spring Boot repositories to return more information after a POST?

1 Answer 1

3

There should be a Location header in the response, with the URI of the just created entity.

Sign up to request clarification or add additional context in comments.

1 Comment

Wow...just staring me in the face! Thanks a ton!

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.