PublishDrive
Api

Complete file upload and attach to book

Complete an upload and attach the file to the book.

If the book status is not draft, a successful attach moves it to draft. This operation returns an empty JSON object; use GET /api/books/{bookPublicId} to read attributes.status if needed.

Call POST /api/books/{bookPublicId}/publish again after all file attaches and book updates are complete.

PATCH
/books/{bookPublicId}/file/{fileId}/attach
apikey<token>

In: header

Path Parameters

bookPublicId*string
Formatuuid
fileId*string
Formatuuid

Request Body

application/json

TypeScript Definitions

Use the request body type in TypeScript.

Response Body

application/json

application/json

application/json

application/json

curl -X PATCH "https://api.publishdrive.com/v2/distribution/books/e9e0d212-52cb-11f1-8d0d-aedf0546306a/file/e9e53726-52cb-11f1-8d0d-aedf0546306a/attach" \  -H "Content-Type: application/json" \  -d '{    "filename": "mybook.epub",    "hashSha256": "9c50bbd0c11fda120232a970f3ee67f993459bb81fda6f35d7ac4cfa9b45d5f5"  }'
{}
{
  "title": "Server Request message failed validation",
  "status": 400,
  "detail": "Server Request message failed validation; Content-Type \"application/x-www-form-urlencoded\" is not expected for Request [patch /api/books/{bookPublicId}/file/{fileId}/attach]",
  "instance": "/v2/distribution/books/e9e0d5a0-52cb-11f1-8d0d-aedf0546306a/file/e9e572d0-52cb-11f1-8d0d-aedf0546306a/attach",
  "invalidParams": []
}
Empty

{
  "message": "Not found"
}

Empty
{
  "message": "File checksum does not match the uploaded content."
}

On this page