So am doing my restful api spring library management project, i have 4 Classes (DTOs too) User, Contactinfo etc etc...
So i have already Created Post, Get, Put, Delete methods for my controllers, now i want extra Post method for my User controller where i can Post present(existing) Contactinfo to present(existing) user... i am stuck dont know what method to implement or what to do, @postmapping(/user/userId/addContact/contactId) <- probably something like that but idk ...
#RestfulApi
17 messages · Page 1 of 1 (latest)
⌛ This post has been reserved for your question.
Hey @tawdry gyro! Please use
/closeor theClose Postbutton above when you're finished. Please remember to follow the help guidelines. This post will be automatically closed after 300 minutes of inactivity.
TIP: Narrow down your issue to simple and precise questions to maximize the chance that others will reply in here.
I think you're trying to link 2 entities right? Link this contact info to this user?
In that case I'd say PUT /user/userid/contact/conractid
You shouldn't add verbs as part of the resource
Ohhh yes sounds smart i will try tomorrow
Btw what controller method probably will like what return type should it have and what parameters should i give ? And how to write service implementation method to use in controller method ?
PUT usually returns a 204 Created if that's what you're asking?
💤 Post marked as dormant
This post has been inactive for over 300 minutes, thus, it has been archived.
If your question was not answered yet, feel free to re-open this post or create a new one.