← BNSF Interview Insights

BNSF·Software Engineer·Take-home Assignment·Intermediate

Intermediate
May 2026

Summary

BNSF had me do a take-home where I built a small REST API from scratch. The twist was that the request body came in as plain text instead of JSON, which I did not expect at all.

Questions Asked (1)

Q1

Build a REST API supporting full CRUD operations where the request body uses Content-Type 'text/plain' instead of JSON. You must parse the body yourself and return both appropriate HTTP status codes and a JSON response with a message field.

API & IntegrationsSystem DesignTechnical Trade-offs
Author's notes

The plain-text body thing tripped me up more than I want to admit.

Create a free account to read the full note

AI HintsAI Generated

Suggested Approach

Start by clarifying the requirements and constraints, then outline a design that separates routing, parsing, and business logic. Emphasize robust error handling and proper HTTP semantics, and discuss trade-offs of using text/plain versus JSON.

Pro tip: Mention that you would document the API contract clearly and consider adding a custom media type or versioning to avoid future breaking changes. Also, highlight the importance of input validation and security even with plain text.

1. Clarify Requirements

Ask about the expected format of the text/plain body, authentication, and any specific status codes or error messages required.

2. Design API Endpoints

Define RESTful routes for CRUD operations (e.g., POST /resources, GET /resources/{id}, PUT /resources/{id}, DELETE /resources/{id}) and specify the expected text/plain body structure.

3. Implement Body Parsing

Describe how to read the raw request body and parse it manually (e.g., using a delimiter or key-value pairs), handling malformed input gracefully.

4. Handle Responses and Errors

Return appropriate HTTP status codes (200, 201, 400, 404, 500) and a JSON response with a message field, ensuring consistency across endpoints.

5. Discuss Trade-offs and Extensions

Talk about why text/plain might be used, potential issues (e.g., lack of structure, parsing complexity), and how to mitigate them (e.g., schema validation, custom media types).

Key Points to Mention

  • HTTP status codes: 200 OK, 201 Created, 400 Bad Request, 404 Not Found, 500 Internal Server Error
  • Manual parsing techniques: splitting by delimiters, using regular expressions, or a simple parser
  • Input validation and sanitization to prevent injection attacks
  • Consistent JSON response format with a message field
  • Trade-offs: text/plain is less structured and harder to parse than JSON, but may be required for legacy systems
  • Documentation and versioning to manage API evolution

AI-generated suggestions, not part of the candidate's original notes. May be inaccurate — verify before relying on them.