Coder Social home page Coder Social logo

Comments (20)

meenakshi-dhanani avatar meenakshi-dhanani commented on August 16, 2024 1

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.

mtreacy002 avatar mtreacy002 commented on August 16, 2024 1

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.

mtreacy002 avatar mtreacy002 commented on August 16, 2024

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.

Screen Shot 2020-05-16 at 7 02 00 am

Screen Shot 2020-05-16 at 7 02 14 am

Link to file

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.

ramitsawhney27 avatar ramitsawhney27 commented on August 16, 2024

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.

mtreacy002 avatar mtreacy002 commented on August 16, 2024

Update:
Hi @anitab-org/bridgeintech-maintainers. Here's the updated API endpoints and error handlings related to Users service

Screen Shot 2020-05-29 at 10 36 25 am

Screen Shot 2020-05-29 at 10 38 02 am

Screen Shot 2020-05-29 at 10 38 55 am

Screen Shot 2020-05-29 at 10 39 20 am

Screen Shot 2020-05-29 at 10 39 49 am

from bridge-in-tech-backend.

ramitsawhney27 avatar ramitsawhney27 commented on August 16, 2024

These look good. What if there is an internal server error?

from bridge-in-tech-backend.

mtreacy002 avatar mtreacy002 commented on August 16, 2024

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

Screen Shot 2020-05-29 at 8 01 14 pm

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.

mtreacy002 avatar mtreacy002 commented on August 16, 2024

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.

Screen Shot 2020-05-29 at 8 24 43 pm

from bridge-in-tech-backend.

meenakshi-dhanani avatar meenakshi-dhanani commented on August 16, 2024

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.

mtreacy002 avatar mtreacy002 commented on August 16, 2024

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.

meenakshi-dhanani avatar meenakshi-dhanani commented on August 16, 2024

from bridge-in-tech-backend.

mtreacy002 avatar mtreacy002 commented on August 16, 2024

Update:
Here's the API endpoints and errors handling for Organizations service

Screen Shot 2020-05-30 at 4 15 53 pm

Screen Shot 2020-05-30 at 4 16 12 pm

Screen Shot 2020-05-30 at 4 16 43 pm

Screen Shot 2020-05-30 at 4 22 14 pm

from bridge-in-tech-backend.

mtreacy002 avatar mtreacy002 commented on August 16, 2024

Update:

So, Here're the latest version for API endpoints

User service

Screen Shot 2020-05-31 at 12 43 26 am

Screen Shot 2020-05-31 at 12 44 42 am

Screen Shot 2020-05-31 at 12 45 07 am

Screen Shot 2020-05-31 at 12 45 31 am

Screen Shot 2020-05-31 at 12 46 01 am

Screen Shot 2020-05-31 at 12 47 26 am

Screen Shot 2020-05-31 at 12 47 41 am

from bridge-in-tech-backend.

mtreacy002 avatar mtreacy002 commented on August 16, 2024

Update:

Organizations service

Screen Shot 2020-05-31 at 12 48 08 am
Screen Shot 2020-05-31 at 12 50 00 am
Screen Shot 2020-05-31 at 12 50 55 am
Screen Shot 2020-05-31 at 12 51 29 am

from bridge-in-tech-backend.

mtreacy002 avatar mtreacy002 commented on August 16, 2024

Update:

Programs service

Screen Shot 2020-05-31 at 12 51 52 am
Screen Shot 2020-05-31 at 12 52 45 am
Screen Shot 2020-05-31 at 12 53 09 am

from bridge-in-tech-backend.

mtreacy002 avatar mtreacy002 commented on August 16, 2024

Update:
API endpoints for Mentorship_Relations service

Screen Shot 2020-05-31 at 8 47 43 pm

Screen Shot 2020-05-31 at 8 49 04 pm

Screen Shot 2020-05-31 at 8 49 25 pm

Screen Shot 2020-05-31 at 8 50 06 pm

Screen Shot 2020-05-31 at 8 50 37 pm

Screen Shot 2020-05-31 at 8 51 10 pm

Screen Shot 2020-05-31 at 8 51 39 pm

Screen Shot 2020-05-31 at 8 52 12 pm

Screen Shot 2020-05-31 at 8 52 37 pm

Screen Shot 2020-05-31 at 8 53 08 pm

Screen Shot 2020-05-31 at 8 53 31 pm

Screen Shot 2020-05-31 at 8 53 54 pm

Screen Shot 2020-05-31 at 8 54 16 pm

Screen Shot 2020-05-31 at 8 54 42 pm

from bridge-in-tech-backend.

ramitsawhney27 avatar ramitsawhney27 commented on August 16, 2024

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.

mtreacy002 avatar mtreacy002 commented on August 16, 2024

Sorry, haven't updated the docs yet, but have actually applied your suggestion in the code base for User Registration (PR#26).
Screen Shot 2020-06-03 at 9 15 17 am

Will change the docs now... 😉

from bridge-in-tech-backend.

mtreacy002 avatar mtreacy002 commented on August 16, 2024

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.

mtreacy002 avatar mtreacy002 commented on August 16, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.