API Fundamentals Course
API Fundamentals
/
Intermediate

API Troubleshooting Questions

Definition

Questions that test your ability to diagnose and fix broken APIs, network failures, and integration bugs.

Explain Like I'm New

The API is broken. The interviewer gives you symptoms and expects you to play detective to find the root cause.

Real World Example

Being asked: 'A user says they cannot log in. The backend logs show no errors. The network tab shows the `/login` request stays 'Pending' forever and then times out. What is wrong?'

Common Use Cases

  • •Practical coding interviews

Terminal Output

bash / terminal
/* Debugging Scenario: The N+1 Problem Symptom: The /dashboard API endpoint works, but it takes 8 seconds to load. Diagnosis: I would check the backend database logs. It is likely suffering from the N+1 problem. The code fetches 100 recent orders (1 query). Then, it loops through the orders, and for EVERY order, it makes a separate query to fetch the User who placed it (100 additional queries). Total: 101 queries for one API request. Fix: Use a SQL JOIN to fetch the Orders and the Users simultaneously in 1 single database query. */

Interview Questions

basic

  • If an API request works perfectly in Postman, but fails with a 401 Unauthorized in your React app, what is likely the problem?

intermediate

  • You get a `502 Bad Gateway` error. Where do you look to fix it?

Flash Cards

Question

Works in Postman but not React?

Click to reveal answer
Answer

You probably forgot to configure your `fetch` or `axios` call to include the `Authorization` header containing the JWT token, or your cookie is missing the `credentials: 'include'` flag.

Question

Fix 502 Bad Gateway?

Click to reveal answer
Answer

The API Gateway or Load Balancer (like NGINX) is working fine, but the actual backend application server (like Node.js) it is trying to route traffic to is offline, crashed, or completely unreachable. You need to restart the application server.