DEVELOPERS / CODE EXAMPLES

Copy. Inspect. Make it yours.

Compact examples for reading records without confusing public fixtures with live observations.

ASIC observations

CURL
curl --fail --silent --show-error \
  https://minerapi.com/api/demo/asic.json

Inspect the raw worker object and its explicit units.

Prompt evaluation record

CURL
curl --fail --silent --show-error \
  https://minerapi.com/api/demo/prompts.json

The sample contains a prompt revision and fictional test metadata.

Validate a response

JAVASCRIPT
function requireDemo(data) {
  if (data?.demo !== true) {
    throw new Error("Expected sample data");
  }
  if (data.schema_version !== "1.0") {
    throw new Error("Unsupported schema");
  }
  return data;
}

Reject an unexpected envelope before using its fields.

Make a missing reading visible

JAVASCRIPT
function displayTemperature(value) {
  if (value === null || value === undefined) {
    return "No observation";
  }
  if (typeof value !== "number" || !Number.isFinite(value)) {
    return "Invalid observation";
  }
  return `${value} °C`;
}

A missing observation is not the same thing as zero degrees.

Build tests around meaning

Use the valid fixture as one test, then add absent fields, incorrect types, unknown versions, and failed requests. A green HTTP response does not establish that the payload matches your consumer contract.

Keep sample records explicitly labeled whenever you show them in a UI. Never use a fixture as a silent fallback when real collection fails. The downloadable sample clients add bounded requests, and the Bitcoin integration guide explains how to organize the next layer.