Przejdź do głównej zawartości

completeFileUpload

Dla: Programista

MutacjaBetaMutation.completeFileUpload

Confirms that the content of a file started with initiateFileUpload was sent. Prynt checks the stored size, marks the file completed and attaches it to its record. A file of a product still in prepress (NO_FILES, FILES_TO_CHECK, WAITING_FOR_ADMIN_RESPONSE, WAITING_FOR_CLIENT_RESPONSE, FILES_ACCEPTED) moves the product to FILES_TO_CHECK and its files back to checking: a new file on a product with accepted files cancels the acceptance. A product already in production or further keeps its status. Only the integration that started the upload may complete it, once.

Wymagany zakresfiles:write
Dostępne odPrynt 0.28.0
StabilnośćBeta (co to znaczy)
PonawianieWysyłaj nagłówek Idempotency-Key, żeby ponowienie nie wykonało zapisu drugi raz. Zapisy i idempotencja

Argumenty

NazwaTypOpis
inputwymaganeCompleteUploadInput!

The file whose upload to complete.

Zwraca

File!

Przykład

Mutacja
mutation CompleteUpload($input: CompleteUploadInput!) {
completeFileUpload(input: $input) {
id
originalFilename
sizeBytes
uploadStatus
verificationStatus
}
}
Zmienne
{
"input": {
"fileId": "e18da4c5-7092-4db4-8fd0-5b6c7d8e9fa7"
}
}
Wywołanie (curl)
IDEMPOTENCY_KEY=$(uuidgen) # ponawiaj z tym samym kluczem
curl -sS https://twoja-drukarnia.prynt.pl/api/v1/graphql \
-H "Authorization: Bearer $PRYNT_API_KEY" \
-H "Content-Type: application/json" \
-H "Idempotency-Key: $IDEMPOTENCY_KEY" \
--data-binary @- <<'JSON'
{
"query": "mutation CompleteUpload($input: CompleteUploadInput!) {\n completeFileUpload(input: $input) {\n id\n originalFilename\n sizeBytes\n uploadStatus\n verificationStatus\n }\n}",
"variables": {
"input": {
"fileId": "e18da4c5-7092-4db4-8fd0-5b6c7d8e9fa7"
}
}
}
JSON
Odpowiedź
{
"data": {
"completeFileUpload": {
"id": "e18da4c5-7092-4db4-8fd0-5b6c7d8e9fa7",
"originalFilename": "ulotka-a5.pdf",
"sizeBytes": "2457600",
"uploadStatus": "COMPLETED",
"verificationStatus": "TO_CHECK"
}
}
}