Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create pet endpoint #86

Closed
chrisbartoloburlo opened this issue Apr 2, 2022 · 3 comments · Fixed by #118
Closed

Create pet endpoint #86

chrisbartoloburlo opened this issue Apr 2, 2022 · 3 comments · Fixed by #118
Labels

Comments

@chrisbartoloburlo
Copy link

chrisbartoloburlo commented Apr 2, 2022

According to the open API spec, there is the following endpoint to create a pet: http://localhost:9966/petclinic/api/pets, however I am getting a 501 error whenever I send a POST request to that URL, indicating that it is not implemented. Is this the case?

haraldreingruber-dedalus pushed a commit to haraldreingruber-dedalus/spring-keycloak-angular-exercise that referenced this issue Sep 22, 2022
…ot/npm_and_yarn/log4js-6.4.0

Bump log4js from 6.3.0 to 6.4.0
@arey arey added the bug label Dec 23, 2022
@arey
Copy link
Member

arey commented Dec 23, 2022

The PetRestController does not override the addPet method of the PetsApi. Thus the below code is executed:

return new ResponseEntity<>(HttpStatus.NOT_IMPLEMENTED);

For creating a new pet, the Angular frontend use the POST /api/owners/{ownerId}/pets endpoint:

curl 'http://localhost:9966/petclinic/api/owners/4/pets' \
  -H 'Accept: application/json, text/plain, */*' \
  -H 'Content-Type: application/json' \
  --data-raw '{"id":null,"owner":{"firstName":"Harold","lastName":"Davis","address":"563 Friendly St.","city":"Windsor","telephone":"6085553198","id":4,"pets":[{"name":"Iggy","birthDate":"2010-11-30","type":{"name":"lizard","id":3},"id":5,"ownerId":4,"visits":[]}]},"name":"New Pet","birthDate":"2022-12-16","type":{"name":"lizard","id":3}}' \

We have to associate a pet with its owner. Thus I propose to remove the POST /api/pets endpoint. It's most easiest.

@alexandre-touret
Copy link
Contributor

Hi @arey
I can work on it if it's possible

Alexandre

@arey
Copy link
Member

arey commented Jul 6, 2023

Hi @alexandre-touret yes sure :)

alexandre-touret added a commit to alexandre-touret/spring-petclinic-rest that referenced this issue Jul 7, 2023
@arey arey closed this as completed in #118 Jul 11, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants