PracHub
QuestionsPremiumLearningGuidesInterview PrepNEWCoaches
|Home/Coding & Algorithms/Stripe

Propagate runtime ID across API requests

Last updated: Mar 29, 2026

Quick Overview

This question evaluates proficiency in runtime ID propagation across HTTP requests, JSON parsing and serialization, nested data traversal, and type-preserving replacement in request URLs and bodies; it is categorized under Coding & Algorithms and focuses on practical application rather than purely conceptual understanding.

  • medium
  • Stripe
  • Coding & Algorithms
  • Software Engineer

Propagate runtime ID across API requests

Company: Stripe

Role: Software Engineer

Category: Coding & Algorithms

Difficulty: medium

Interview Round: Technical Screen

## Debug chained API requests by propagating a runtime ID You are given a sequence of **5 API requests** that must be executed in order. - Request 1 (a `POST`) succeeds and returns `200 OK` with a JSON response containing a newly created resource ID. - Requests 2–5 currently fail because they incorrectly use a **hardcoded** ID (e.g., `"123"`) in their **URL path and/or JSON body** instead of the ID returned by Request 1. ### Task Write a function that, given: 1. `requests`: a list of request objects in execution order. Each request has: - `method` (string) - `url` (string) - `headers` (map of string → string) - `body` (either `null`, a JSON object, or a JSON string) 2. `first_response_body`: the parsed JSON body returned by Request 1, which includes the runtime ID (for example under `id`) 3. `old_id`: the hardcoded ID value currently present in later requests returns a **new list of requests** where, for Requests 2–5: - Every occurrence of `old_id` in the request **URL** is replaced with the runtime ID from `first_response_body`. - Every occurrence of `old_id` anywhere inside the request **body** (including nested fields, arrays, and string values) is replaced with the runtime ID. ### Requirements / Notes - Do **not** modify Request 1. - The runtime ID may be numeric or string; preserve the correct type when updating JSON bodies. - The request body may be `null`, a JSON object, or a JSON string (in which case you should parse it, modify it, then serialize it back). - Assume all requests are well-formed; focus on correct propagation and replacement. ### Output Return the updated list of request objects.

Quick Answer: This question evaluates proficiency in runtime ID propagation across HTTP requests, JSON parsing and serialization, nested data traversal, and type-preserving replacement in request URLs and bodies; it is categorized under Coding & Algorithms and focuses on practical application rather than purely conceptual understanding.

Related Interview Questions

  • Assign Reviewers from Changed Files - Stripe (medium)
  • Generate Account Email Notifications - Stripe (medium)
  • Calculate Transaction Fees - Stripe (medium)
  • Build an Account Transfer Ledger - Stripe (medium)
  • Implement Validation and String Compression - Stripe (hard)
Stripe logo
Stripe
Jan 22, 2026, 12:00 AM
Software Engineer
Technical Screen
Coding & Algorithms
7
0
Loading...

Debug chained API requests by propagating a runtime ID

You are given a sequence of 5 API requests that must be executed in order.

  • Request 1 (a POST ) succeeds and returns 200 OK with a JSON response containing a newly created resource ID.
  • Requests 2–5 currently fail because they incorrectly use a hardcoded ID (e.g., "123" ) in their URL path and/or JSON body instead of the ID returned by Request 1.

Task

Write a function that, given:

  1. requests : a list of request objects in execution order. Each request has:
    • method (string)
    • url (string)
    • headers (map of string → string)
    • body (either null , a JSON object, or a JSON string)
  2. first_response_body : the parsed JSON body returned by Request 1, which includes the runtime ID (for example under id )
  3. old_id : the hardcoded ID value currently present in later requests

returns a new list of requests where, for Requests 2–5:

  • Every occurrence of old_id in the request URL is replaced with the runtime ID from first_response_body .
  • Every occurrence of old_id anywhere inside the request body (including nested fields, arrays, and string values) is replaced with the runtime ID.

Requirements / Notes

  • Do not modify Request 1.
  • The runtime ID may be numeric or string; preserve the correct type when updating JSON bodies.
  • The request body may be null , a JSON object, or a JSON string (in which case you should parse it, modify it, then serialize it back).
  • Assume all requests are well-formed; focus on correct propagation and replacement.

Output

Return the updated list of request objects.

Comments (0)

Sign in to leave a comment

Loading comments...

Browse More Questions

More Coding & Algorithms•More Stripe•More Software Engineer•Stripe Software Engineer•Stripe Coding & Algorithms•Software Engineer Coding & Algorithms
PracHub

Master your tech interviews with 7,500+ real questions from top companies.

Product

  • Questions
  • Learning Tracks
  • Interview Guides
  • Resources
  • Premium
  • For Universities
  • Student Access

Browse

  • By Company
  • By Role
  • By Category
  • Topic Hubs
  • SQL Questions
  • Compare Platforms
  • Discord Community

Support

  • support@prachub.com
  • (916) 541-4762

Legal

  • Privacy Policy
  • Terms of Service
  • About Us

© 2026 PracHub. All rights reserved.