Dataford
Interview QuestionsInterview GuidesExperiencesMock InterviewsPricing
Get started

Troubleshooting API Issues Step by Step

MediumPython00:00
Practice interviewer
In session
5 left
00:00

Your question is Troubleshooting API Issues Step by Step. Start with the requirements on the right.

Run and submit as often as you like. When you're ready, talk me through your approach or go straight to the code.

You need to log in / sign up to run or submit.

Problem

What are APIs and how would you fix different types of API issues, step by step?

Implement diagnose_api_issues(records, timeout_ms). Each record is a dictionary containing status, latency_ms, auth_valid, and body_valid. Return one dictionary per record with an issue category and an ordered list of remediation steps. Apply rules in this order: authentication, rate limiting, server failure, client failure, invalid response, timeout, then success. Each record must produce exactly one result.

Constraints

  • 1 <= len(records) <= 10^4
  • 0 <= latency_ms <= 10^9
  • 0 <= timeout_ms <= 10^9
  • 400 <= status <= 599 or 200 <= status <= 399
  • Each record contains exactly status, latency_ms, auth_valid, and body_valid
  • Each record produces exactly one result

Function Signature

def diagnose_api_issues(records, timeout_ms):
Your solutionPython 3
You need to log in / sign up to run or submit.
Run your code to see test output