DoorDash Coding Interview / Online Assessment: REST API Aggregation for Bootstrap Data

36 Views
No Comments

Create a REST API that exposes the following endpoint:

GET /api/bootstrap

Request Input

  • User Id

Response

  • Address Data: address including the user’s name, street, city, state, and zip
  • Consumer Data
  • Consumer Roles
  • Payment Data
  • Default Payment Card
  • Gift card credits available

This endpoint needs to request and aggregate Address Data, Consumer Data, and Payment Data from internal DoorDash services.

When the DoorDash app starts up on mobile devices, it needs to fetch some data about the user in order to proceed past the initial splash screen.

If the mobile client does not get a 2xx status code response, the user is unable to proceed past the splash screen, resulting in a bad user experience.

You are tasked with implementing an API that exposes the required information and is as resilient to failures as possible in order to ensure a good user experience.

Expected response if all dependencies are available:

{
  "consumerId": "1bef988e-e544-11ed-b5ea-0242ac120002",
  "roles": [],
  "defaultCard": {
    "lastFourDigits": "1234",
    "expirationYear": "2024",
    "expirationMonth": "01",
    "fingerPrint": "f3cd76f4-e544-11ed-b5ea-0242ac120002",
    "createdAt": "2022-07-15"
  },
  "availableGiftCardCredits": "0.0",
  "address": "Foo Bar, 303 2nd Street, San Francisco, CA 94105"
}

Internal APIs:

  • GET /api/consumers/{userId}
  • GET /api/payment_methods/{consumerId}
  • GET /api/address/{consumerId}

This DoorDash interview question focuses on designing an aggregation-style REST API for the mobile bootstrap flow. The service must combine data from consumer, payment, and address backends into a single response so the app can continue past the splash screen. The main challenge is not algorithmic complexity but resilient service orchestration: fetch the required data, merge it carefully, and prefer returning a useful 2xx response whenever possible.

END
 0