AlmondTill/G3N API

updateWarranty

mutation · in the family Warranty

What it does

Edit warranty terms on what you sell — change its details.

Edit a Warranty's editable fields — an ordinary revision, not a state change; a doomed Warranty cannot be edited (CONFLICT/IMMUTABLE). Refused while your organization's account is restricted. Send the record's current revision; a stale one is refused (CONFLICT/REVISION_STALE) — read again and retry.

Before you call

A bearer session from an API key (see Authentication and key hygiene) or a signed-in user.

Capability area: Selling — Ringing sales, serving customers and issuing invoices.

Roles that may call it:

Careful

Edits take effect immediately and write a new revision; the old revision stays in history.

Arguments

NameTypeRequiredNotes
idID ID!yesThe id of the record.
revisionID ID!yesThe revision id you read on the record; the change is refused if an edit landed in the meantime.
inputEditWarrantyInput EditWarrantyInput!yesEdit-input for a Warranty.

Concurrency

Send the record’s current revision from your last read as revision. A stale revision is refused as CONFLICT/REVISION_STALE — read the record again and retry with the new value.

Returns

Warranty Warranty! — A Warranty — the warranty instance: one sold order line under one WarrantyTerms template. Born by the platform when the sale completes (paid AND delivered) for every variant line whose product carries an active product-attached template or whose variant names a manufacturer carrying an active manufacturer-attached template (one warranty per matching template); never created on the wire. The policy is snapshotted at birth (provider · durationDays → expiresAt = startsAt + durationDays), so later template edits never rewrite an issued warranty. active → expired is the scheduler’s over expiresAt; active → claimed is fileClaimWarranty (a warranty_claim CsCase linked both ways). The serial number is optional and stamped through updateWarranty. Listings keep expired warranties as coverage history (the settled-payment class — a status filter narrows to active); every warranty stays reachable by id from the order line’s warrantyIds.

Example request

graphql
mutation ExampleUpdateWarranty($id: ID!, $revision: ID!, $input: EditWarrantyInput!) {
  updateWarranty(id: $id, revision: $revision, input: $input) {
    id
    sysId
    type
    caption
    status
    parentId
    rootId
    createdAt
    updatedAt
    revisionNum
    revision
    organizationId
    orderLineNo
    variantId
    productId
    warrantyTermsId
    provider
    durationDays
    quantity
    startsAt
    expiresAt
    consumerId
    serialNumber
    caseId
  }
}

Variables:

json
{
  "id": "01900000-0000-7000-8000-9f906bed0000",
  "revision": "01900000-0000-7000-8000-b7960e180000",
  "input": {
    "serialNumber": "<serial number>"
  }
}

Send it with the envelope naming the version: "extensions": {"at": {"version": {"name":"genesis","number":0}}}.

Example response

json
{
  "data": {
    "updateWarranty": {
      "id": "01900000-0000-7000-8000-9f906bed0000",
      "sysId": "WR-EXMP-0000-000F",
      "type": "Warranty",
      "caption": "Blue jeans",
      "status": "active",
      "parentId": "01900000-0000-7000-8000-18e782370000",
      "rootId": "01900000-0000-7000-8000-a1295a650000",
      "createdAt": "2027-01-31T00:00:00.000Z",
      "updatedAt": "2027-01-31T00:00:00.000Z",
      "revisionNum": 1,
      "revision": "01900000-0000-7000-8000-53c6eea90000",
      "organizationId": "01900000-0000-7000-8000-1971e30a0000",
      "orderLineNo": 1,
      "variantId": "01900000-0000-7000-8000-8433b0260000",
      "productId": "01900000-0000-7000-8000-529c60cc0000",
      "warrantyTermsId": "01900000-0000-7000-8000-63c8e3d40000",
      "provider": "manufacturer",
      "durationDays": 1,
      "quantity": "2",
      "startsAt": "2027-01-31T00:00:00.000Z",
      "expiresAt": "2028-01-31T00:00:00.000Z",
      "consumerId": "01900000-0000-7000-8000-3cbb3ce90000",
      "serialNumber": "<serial number>",
      "caseId": "01900000-0000-7000-8000-1b5184d10000"
    }
  },
  "extensions": {
    "at": {
      "callId": "01EXAMPLE-CALL-ID",
      "version": {
        "requested": {
          "name": "genesis",
          "number": 0
        },
        "serviced": {
          "name": "genesis",
          "number": 0
        }
      }
    }
  }
}

Errors this call can answer

Dry run

Add dryRun: true to the request envelope (extensions.at) to rehearse this call: every check runs, the write is rehearsed against the current records and nothing is stored; the answer is the refusal a real call would give, or the record it would create. Every response to a rehearsal carries dryRun: true, so a rehearsed record is never mistaken for a saved one.

Used in