Skip to content

Product Files Resource

The product files resource provides an endpoint for product asset data upload, retrieval and removal.

URL:

https://api.openpublishing.com/resource/v3/products/[ID]/files
https://api.openpublishing.com/resource/v3/products/[ID]/files/[ID]

Supported methods:

POST to products/[ID]/files URL for adding product files in a multipart/form encoded body with the following parameters:

  • file the file itself
  • type of the file that is being imported, following values are supported:
    • pod_bookblock: Print-On-Demand book block
    • ebook_pdf: eBook in PDF format
    • ebook_pdf_cover: cover for eBook in PDF format
    • ebook_pdf_bastard_title: bastard title for eBook in PDF format
    • ebook_epub: eBook in EPUB format
    • ebook_mobi: eBook in Mobi format
    • ebook_ibook: eBook in iBook format
    • cover_marketing: marketing cover
    • pod_cover_front: Print-On-Demand front cover
    • pod_cover_back: Print-On-Demand back cover
    • pod_cover: Print-On-Demand cover
    • dropbox: Dropbox file
    • extract: extract
    • screenshot: screenshot
    • shop_preview: shop preview
    • audiobook: audio book
    • software: software
  • labels distribution tags, should start with distribution: prefix.

GET to products/[ID]/files for retrieving information about all product files.

Supported query parameters: - type: type of file - labels: labels to lookup - mime_type: MIME type of the file - file_name: document file name - property_epub_version: EPUB version (e.g. 2 or 3)

GET to products/[ID]/files/[ID] for retrieving information about a specific product asset.

DELETE to products/[ID]/files/[ID] to delete a product asset.

Example JSON

{
    "_id": 2,
    "file_name": "example_file_name.epub",
    "file_size": 1752680,
    "href": "https:\/\/api.openpublishing.com\/rpc\/document_admin_upload?method=download&file_id=2",
    "labels": [],
    "mime_type": "application/epub+zip",
    "properties": {
        "epub_version": "3"
    },
    "sha1": "17c1415da57c11cd2fdbd94edbbd3eeae7fcbc32",
    "timestamp": 1656057222,
    "type": "ebook_epub",
    "validation": null
}