Connect JSON Coordinates Through a Documented Drawing API
StripeSoftware Engineer · OnsiteLast updated
Plan coordinate parsing and drawing-API integration with explicit geometry semantics, request mapping, error handling, and idempotent recovery.
Design a small program that reads JSON coordinate data and calls a provided drawing API to connect the points into a map or line drawing. Explain how you would interpret the input, construct the documented request body, and handle API failures.
Constraints
The API name, endpoint, authentication, request schema, coordinate reference system, and connectivity rules are not supplied. The implementation environment provides API documentation and a sample body; inspect those before choosing field names. This is a real-API integration task, not a portable algorithm console.
Clarifying Questions
- Are the coordinates Cartesian positions or geographic coordinates, and what is their order and unit?
- Should points be connected in input order, grouped into paths, or joined according to explicit edges?
- Does the API accept a whole path or separate segments, and is the final point connected to the first?
- Which failures may be retried, and can a repeated request duplicate a drawing?
Hints
Hint 1
Validate a small path against the documented body: A coordinate pair can be syntactically valid JSON while still having its axes or units reversed for the API.
Follow-up questions
- How would you handle several disconnected paths in one input?
- How would you recover if the API accepted a request but the response was lost?
Solution walkthrough is for members
Get the full walkthrough with reference code and complexity analysis, plus Kitty Coach at 300 messages a day. Hints, the code runner and community answers stay free.