Skip to content
CodeKruPro

Logged in, but not allowed: which status code?

QuizEasy-MediumAsked in: Accenture, Capgemini, Infosys, TCS, Wipro

A logged-in customer with a valid token calls DELETE /admin/users/7, which only admins may use. Which answer is correct?

  • 403 Forbidden, or 404 Not Found if the API hides resources the caller may not see
  • 401 Unauthorized
  • 200 OK with an error message in the body
  • 405 Method Not Allowed

This question is part of Pro+

Pro+ opens every question in Interview Prep and the mock interview. Every article and the first 2 questions of each topic stay free. Hands-on Selenium and API tasks follow their course lesson's own lock.

See Pro+

Already have Pro+? Sign in