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

Backend - API Convention: Data Structure, Error Handling, Response Codes #290

Closed
rburaksaritas opened this issue Oct 10, 2023 · 9 comments
Closed
Assignees
Labels
effort: level 3 How much effort is needed for this task priority: medium Issue is of medium importance, can be fixed in a reasonable time team: back-end Issue is part of back-end development type: documentation Improvements or additions to documentation

Comments

@rburaksaritas
Copy link
Contributor

Issue Description

To maintain consistency, clarity, and efficient debugging across our services, we need to standardize the API convention. This documentation will detail the preferred data structures, methodologies for error handling, and guidelines on response codes.

Deadline of the Issue

17.10.2023

Reviewer

Begüm Arslan

@rburaksaritas rburaksaritas added type: documentation Improvements or additions to documentation priority: medium Issue is of medium importance, can be fixed in a reasonable time effort: level 3 How much effort is needed for this task labels Oct 10, 2023
@rburaksaritas rburaksaritas changed the title API Convention - Data Structure, Error Handling, Response Codes etc. API Convention - Data Structure, Error Handling, Response Codes Oct 10, 2023
@rburaksaritas rburaksaritas added the team: back-end Issue is part of back-end development label Oct 10, 2023
@rburaksaritas
Copy link
Contributor Author

@mehmetkuzu did a great job to start @ https://github.com/bounswe/bounswe2023group2/wiki/API-conventions.
I added the URI naming convensions as discussed in the Backend team meeting.
Also modified the general categorization & heading hiearchy structure etc.

@rburaksaritas rburaksaritas changed the title API Convention - Data Structure, Error Handling, Response Codes Backend - API Convention: Data Structure, Error Handling, Response Codes Oct 14, 2023
@mehmetkuzu
Copy link
Contributor

@mehmetkuzu did a great job to start @ https://github.com/bounswe/bounswe2023group2/wiki/API-conventions. I added the URI naming convensions as discussed in the Backend team meeting. Also modified the general categorization & heading hiearchy structure etc.

Thanks. Good job.

Just one point:

Incorrect Correct
POST /createUser POST /users
PUT /updateUser/1 PUT /users/1
DELETE /deleteUser/1 DELETE /users/1

This probably is a common practice. But are you sure? Why not PUT /users/create or PUT /user/create ? These numbers (1). Are they really the best way?

(Just asking to learn.)

@rburaksaritas
Copy link
Contributor Author

rburaksaritas commented Oct 14, 2023

@mehmetkuzu did a great job to start @ https://github.com/bounswe/bounswe2023group2/wiki/API-conventions. I added the URI naming convensions as discussed in the Backend team meeting. Also modified the general categorization & heading hiearchy structure etc.

Thanks. Good job.

Just one point:

Incorrect Correct
POST /createUser POST /users
PUT /updateUser/1 PUT /users/1
DELETE /deleteUser/1 DELETE /users/1
This probably is a common practice. But are you sure? Why not PUT /users/create or PUT /user/create ? These numbers (1). Are they really the best way?

(Just asking to learn.)

As far as i know, for example, POST is only used to create an entity, so URI like POST users/create/ is redundant, and basically means the same thing as POST users/ . Simlarly, PUT is only used to update an entity, therefore PUT users/id mean the same thing as PUT users/update/id defaultly.

@mehmetkuzu
Copy link
Contributor

Thanks. That tells.

But should we write:
PUT /users/{user_id}
instead of
PUT /users/1

@rburaksaritas
Copy link
Contributor Author

Thanks. That tells.

But should we write: PUT /users/{user_id} instead of PUT /users/1

yes, 1 is just an example id.

@azizamankenova
Copy link
Contributor

Thanks for your efforts!
I wanted to ask if we need to include the ID of the newly created item as a result of the post request 3.1.3 POST - Create New Item (HTTP 201)?

@mehmetkuzu
Copy link
Contributor

Thanks for your efforts! I wanted to ask if we need to include the ID of the newly created item as a result of the post request 3.1.3 POST - Create New Item (HTTP 201)?

You are right. The message structure also should be revised. I will check that now.

@mehmetkuzu
Copy link
Contributor

Can we close this one? (We can always update the document during the actual work)

@bgmrsln
Copy link
Contributor

bgmrsln commented Oct 16, 2023

Seems great! Closing the issue.

@bgmrsln bgmrsln closed this as completed Oct 16, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
effort: level 3 How much effort is needed for this task priority: medium Issue is of medium importance, can be fixed in a reasonable time team: back-end Issue is part of back-end development type: documentation Improvements or additions to documentation
Projects
None yet
Development

No branches or pull requests

5 participants