Code Room
Code reviewHardcr-g357
Subject Api designLevel Senior–Staff~25 minCommon in Networking & APIs interviewsIndustries Software development, Technology

Question

Review this Python batch-send endpoint. It accepts up to 1000 messages and returns 200 when 'done.'

What a strong answer looks like

Separate real bugs from style. Rank issues by severity, point at the root cause rather than the symptom, and suggest a concrete fix — specific and kind.

Talk through your review
Code to reviewpython
@app.post('/messages/batch')def batch_send():    msgs = request.get_json()['messages']    sent = []    for m in msgs:        provider.send(m['to'], m['body'])  # may raise per-message        sent.append(m['id'])    return jsonify({'status': 'ok', 'sent': sent}), 200
Run or narrate your approach, then ask the coach.