Comments (20)
Ideally, if MS has the logic of the API, then MS error codes need to be appropriate. Let's open issues on MS, if we can pick them up because this affects BIT too, let's do that. If we don't fix MS, there will be some unnecessary code on BIT, which might have to be removed once MS is fixed, so let's fix the source(because we can). Create them as issues on MS I say, if we can let's help someone who picks it up or let's pick it up. (Don't be blocked by it though)
from bridge-in-tech-backend.
I agree with @meenakshi-dhanani .
@ramitsawhney27, @isabelcosta and @foongminwong. would you be ok if I open the issues on MS backend to fix the misrepresented http error codes?
Note that the 18 highlighted error codes that need to be replaced must be represented in separate issue (individually), or at least per function (e.g. user register function) so not to block the BIT development coz the changes can be done gradually.
from bridge-in-tech-backend.
Hi @anitab-org/bridgeintech-maintainers, below is the screenshot of what I have in mind for API endpoints and their related CRUD operations in relation to Users API service. Please give me feedback to whether or not this makes sense to you all.
Note: I haven't decided on the API endpoints for Home
and Dashboard
yet because it'll come after I get more picture on the whole API endpoints
from bridge-in-tech-backend.
For the initial few endpoints, as you start implementing them, you should be documenting the error codes. For example: 400 bad request - and when would you return this?
from bridge-in-tech-backend.
Update:
Hi @anitab-org/bridgeintech-maintainers. Here's the updated API endpoints and error handlings related to Users service
from bridge-in-tech-backend.
These look good. What if there is an internal server error?
from bridge-in-tech-backend.
I'm thinking to mask it with response 500 but display the error message as it would catch by the HTTPError exception. As mentioned in the below
Would this be Ok, @ramitsawhney27? If you agree to this, I would add error code 500 on it as well with unspecified message (coz it'll be whatever returned by the response)
from bridge-in-tech-backend.
Update:
I've added error response 500 in all API requests because of the possibilities of internal error can happen anywhere in the request.
Below just an example of what I've added.
from bridge-in-tech-backend.
Hey Maya,
Everything looks good. Just a question to think about the login api. So if there's any issue with authentication it makes sense to return a 401. Find explanation in the RFC here.
And in case the credentials a wrong, if you send back a 404, it might give a tip to the malicious users, to try combinations. A 401 should work for any invalid credentials.
from bridge-in-tech-backend.
Hi @meenakshi-dhanani. That also makes sense to me, tbh (although I'm not sure about the 404 giving more tip to malicious user more than 401 does, 😃). However, in terms of error code, as BIT is using MS API service for this one (login), I don't know if it's a good idea to change the error code from 404 (given by the MS API) to 401 on BIT UI to client. Shouldn't BIT only passing whatever value is returned by MS API?
@ramitsawhney27 and @isabelcosta, is there any reason to use 404 instead of 401 on MS API on this matter? Is BIT allowed to change this?
from bridge-in-tech-backend.
from bridge-in-tech-backend.
Update:
Here's the API endpoints and errors handling for Organizations service
from bridge-in-tech-backend.
Update:
So, Here're the latest version for API endpoints
User service
from bridge-in-tech-backend.
Update:
Organizations service
from bridge-in-tech-backend.
Update:
Programs service
from bridge-in-tech-backend.
Update:
API endpoints for Mentorship_Relations service
from bridge-in-tech-backend.
Hi @mtreacy002, your error codes and specs look great. Thank you for the great work with them. One small suggestion, could we use "201-Created", rather than "200-OK" as the error code if something new is created? This is as per our previous discussions in weekly meetings.
from bridge-in-tech-backend.
Sorry, haven't updated the docs yet, but have actually applied your suggestion in the code base for User Registration (PR#26).
Will change the docs now... 😉
from bridge-in-tech-backend.
Hi @anitab-org/bridgeintech-maintainers. I have updated the docs for the REST API Endpoints and errors handling here. Also, I highlighted 18 error codes that I think would require changes to be done on Mentorship System backend side. This is because if we change it on MS backend, it only needs to change the word selection on HTTPStatus itself whereas if we want to keep MS as it is and mask the codes on BIT side, we would need to write extra lines of codes (e.g. if
condition and even sometimes doing for
loop) for each of the error points.
Please let me know what you think.
from bridge-in-tech-backend.
Update @anitab-org/bridgeintech-maintainers . Closing this as discussion on API endpoints will be ongoing on BridgeInTech Proposal Review doc
from bridge-in-tech-backend.
Related Issues (20)
- Improvement: Refactor code to use dict.get() method HOT 2
- Improvement: refactor expected_fields_validator HOT 10
- Task: Set up local environment HOT 7
- Improvement: Add typehints to User module HOT 3
- Improvement: Add typehints to Organization module HOT 3
- Improvement: Add typehints to Programs module HOT 6
- Research : Ideas for how to add members to an organization HOT 1
- Research : Integrate Notifications HOT 15
- Migrating Travis to Github action HOT 9
- Frontend UI Redesign HOT 3
- Migrating to Github Actions
- Fix tests failing on github actions HOT 6
- test
- Improve Github actions HOT 4
- Dev: Add BIT web gh-pages remote to CORS
- Dev: Move Docusaurus from surge to gh-pages HOT 3
- Docs : Add setup tutorial to `.github/ENV_SETUP_INSTRUCTION.md` HOT 3
- Make project beginner friendly HOT 8
- Update organization name from AnitaB.org to anitab-org in docusaurus config HOT 2
- Update github email and name in documentation workflow HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from bridge-in-tech-backend.