Przejdź do głównej zawartości

updateOperation

Dla: Programista

MutacjaBetaMutation.updateOperation

Changes one operation of an element: fields left out keep their values, null clears only the fields that say so. The order must not be archived. machineId cannot change while a production task of the operation is planned, running or paused (OPERATION_IN_PRODUCTION): finish or cancel the task in Prynt first; completed tasks keep the machine they ran on, and the next task takes the new one. An API key may move an operation only to a machine in use (MACHINE_INACTIVE) with a default task type (MACHINE_NO_DEFAULT_TASK_TYPE). A new machine takes the operation off the pinned top of the queue of its old machine. A new timePerUnitSeconds replaces the machine time the calculation estimated (setup and run) with timePerUnitSeconds times quantity; a new quantity alone keeps the setup of the calculation and counts its run for the new quantity. A quantity at or below quantityCompleted makes the operation completed. Sending the same values again changes nothing, not even Operation.updatedAt or Order.updatedAt (price and quantity are compared after rounding to 2 and 3 decimal places), so a retry is safe without Idempotency-Key.

Wymagany zakresorders:write
Dostępne odPrynt 0.33.0
StabilnośćBeta (co to znaczy)
PonawianieOperacja idempotentna: ponowienie bez nagłówka Idempotency-Key jest bezpieczne. Zapisy i idempotencja

Argumenty

NazwaTypOpis
idwymaganeID!

Identifier of the operation to change.

inputwymaganeUpdateOperationInput!

What to change: fields left out keep their values. An explicit null is refused unless the field says otherwise.

Zwraca

Operation!

Przykład

Mutacja
mutation UpdateOperation($id: ID!, $input: UpdateOperationInput!) {
updateOperation(id: $id, input: $input) {
id
machineId
quantity
unit
timePerUnitSeconds
updatedAt
}
}
Zmienne
{
"id": "2b3c4d5e-6f7a-4b8c-9d0e-1f2a3b4c5d02",
"input": {
"machineId": "4e5f6a7b-8c9d-4e0f-9a1b-2c3d4e5f6a7b",
"quantity": 2600
}
}
Wywołanie (curl)
curl -sS https://twoja-drukarnia.prynt.pl/api/v1/graphql \
-H "Authorization: Bearer $PRYNT_API_KEY" \
-H "Content-Type: application/json" \
--data-binary @- <<'JSON'
{
"query": "mutation UpdateOperation($id: ID!, $input: UpdateOperationInput!) {\n updateOperation(id: $id, input: $input) {\n id\n machineId\n quantity\n unit\n timePerUnitSeconds\n updatedAt\n }\n}",
"variables": {
"id": "2b3c4d5e-6f7a-4b8c-9d0e-1f2a3b4c5d02",
"input": {
"machineId": "4e5f6a7b-8c9d-4e0f-9a1b-2c3d4e5f6a7b",
"quantity": 2600
}
}
}
JSON
Odpowiedź
{
"data": {
"updateOperation": {
"id": "2b3c4d5e-6f7a-4b8c-9d0e-1f2a3b4c5d02",
"machineId": "4e5f6a7b-8c9d-4e0f-9a1b-2c3d4e5f6a7b",
"quantity": 2600,
"unit": "SHEETS",
"timePerUnitSeconds": 2,
"updatedAt": "2026-11-03T08:12:40.511Z"
}
}
}