Skip to content

Using the sandbox

The sandbox runs the production API code over an in-memory database; only Microsoft is faked. Its Microsoft is stateful: it remembers what it accepted per subscription, dimension and hour and answers Duplicate for it afterwards, exactly as the real one does. GET / returns a plain-text summary.

Seeded data

Subscription idOfferDimensions
22222222-2222-2222-2222-222222222222Northwind On Demand (metered)transaction_tier_1 … transaction_tier_6
11111111-1111-1111-1111-111111111111Northwind Insights (flat rate)none

The metered subscription comes with the previous seven days of usage across all six tiers, so /usage and /financials return data before you have charged anything. Accepted charges appear in both immediately.

Fault injection. Add the header X-Sandbox-Outcome to a charge request. Production ignores this header, so never send it there: the call would be a real charge.

ValueWhat happens
unavailableMicrosoft never reached: 502, Retryable: true, no verdict. The retry lands
lostMicrosoft accepted but the response was lost: 502, Retryable: true. The retry with the same hour gets 409 Duplicate. This is the case your retry loop must survive
duplicateMicrosoft had already accepted this hour: 409 Duplicate, and stays 409
throttled429 with an empty body
resource-not-found, resource-not-authorized, resource-not-active, invalid-dimension, invalid-quantity, bad-argument, expiredThe corresponding Microsoft rejection, returned as 422
server-errorMicrosoft 500, returned as 502 Retryable: true

POST /sandbox/reset (with the key) forgets every charge and restores the seeded history. Let in-flight calls finish first.

What the sandbox does not do

  • Microsoft's real latency, real error message wording, and any verdict not listed above. Codes are Microsoft's; message text is modelled on Microsoft's documentation.
  • The 10-requests-per-minute limit that production applies to the GET endpoints.
  • Persist anything: state lives in memory and is lost on restart or reset.
  • Your data: subscriptions, dimensions and reports are seeded examples.

Two production behaviours the sandbox reproduces on purpose: an unknown subscription id on GET /subscriptions/{id} answers 500 rather than 404, and dates from Microsoft's reports come back without a time zone.