swsnu / swppfall2021

Learning Software Engineering By Building Web Services
28 stars 19 forks source link

[hw4] JSON format of POST, PUT method #130

Open tippy33 opened 3 years ago

tippy33 commented 3 years ago

Hello, while I was doing hw4, I wanted to make sure of the JSON format of POST, PUT method in /api/article/, /api/article/:article_id/, /api/article/:article_id/comment/, /api/comment/:comment_id/

POST /api/article/: Create an article with the information given by request JSON body and response with 201. Posted article (with it's assigned id) should be included in response's content as JSON format.

PUT /api/article/:article_id/: Update the target article with the information given by request JSON body and response with 200. Updated article (with it's id) should be included in response's content as JSON format.

POST /api/article/:article_id/comment/: Create a comment with the information given by request JSON body and response with 201. Posted comment (with it's assigned id) should be included in response's content as JSON format.

PUT /api/comment/:comment_id/: Update the target comment with the information given by request JSON body and response with 200. Updated comment (with it's id) should be included in response's content as JSON format.

Here, does it mean that I need to include id, content, title, author in POST, PUT methods of articles and id, content, author, article in POST, PUT methods of comments?
Or does it mean only id, content, title in articles and id, content in comments? I just wanted to make sure. Thank you very much.

ttoru96 commented 3 years ago

It means that you should include id, content, title, author in POST, PUT methods of articles and id, content, author, article in POST, PUT methods of comments.

hursuhyun commented 3 years ago

Hello, I have another question:

Should the author,article contain the id or the name(string)?

Thank you.

Zagoshipda commented 3 years ago

@hursuhyun I think you can find the answer here : https://github.com/swsnu/swppfall2021/issues/112#issuecomment-951800669