TABLE OF CONTENTS

Title errors can be retrieved either by actively polling the book metadata or by setting a trigger to get title a Title Errors notification.

Fixing Spec Check Errors

Spec check errors are fixed by editing the component metadata.


1. View the spec check results for more information on the error. For example, consider this report in the book metadata:


// Request
 // GET https://product-api.oneflowcloud.com/api/books/5f842a76f418ea00128a7d9f
GET {{piazza-base}}/api/books/{{bookId}}

 // Response
 {
     "_id": "5f842a76f418ea00128a7d9f",
     "status": "printready",
     "tags": [
         "Demo", "Title Ingestion"
    ],
     "errorStatuses": [],
     "catalogueIds": [],
     "actionIds": [],
     "sourceProductId": "9782348620548",
     "specificationId": "5f832e47e0f8bd0012100be3",
     "accountId": "5ac79ea7b0c3b91a004b7a2a",
     "components": [{
    "preflightStatus": "success",
    "specCheckStatus": "failed",
    "specCheckErrors": [{
        "type": "trimBox.height",
        "targetValue": 244,
        "value": 245.88611111111112,
        "diff": 1.88611111111112,
        "pages": [ 1, 2 ],
        "pageConfig": 0,
        "ranges": ["1-360"]
    }],
    "status": "dataready",
     …
}


2. Fix component metadata. In this case, the height was set incorrectly at the component level and is fixed by patching the component metadata with a new height value.


// Request
 // PATCH https://product-api.oneflowcloud.com/api/books/5f842a76f418ea00128a7d9f
PATCH {{piazza-base}}/api/components/{{textCompId}}
 
// Body
{
     "code": "text",
     "height": 246
}

3. Initiate spec-check again. Only initiate the spec check at this point. Do not initiate the preflight check.


// Request
 POST {{piazza-base}}/api/books/{{bookId}}/specCheck/{{textCompId}}

4. Analyze the spec check results.

Preflight Errors

1. Locate the preflight report. There may be a need to fix the PDF, reload it, and re-check it. The following is a report returned in book metadata:

The preflight report can be retrieved from components[i].preflightReportUrl
// Request
 GET {{piazza-base}}/api/books/{{bookId}}

 // Response


    "components": [
        {
            "preflightStatus": "failed",
            "_id": "5f84407de0f8bd0012118d1e",
            "componentId": "5f8302e1f418ea001288ed35",
            "fileId": "5f82acc4783fd8f5ebdcfcb6",
            "barcodes": [],
            "preflightReportUrl": "https://live-workforce-files.s3-eu-west-...",
            "preflightReport": [
                {
                     "fixup_id": "FIX23",
                     "name": "FIX23",
                     "type": "fixup",
                     "count": "1",
                     "severity": "SUCCESS",
                     "display_name": "Optimize the PDF for fast web view",
                     "display_comment": "Optimizes the PDF for fast web view. Linearizes the PDF such that it can be served more quickly over the internet by a web server that supports byte serving."
                }, {
                     "fixup_id": "FIX35",
                     "name": "FIX35",
                     "type": "fixup",
                     "count": "7",
                     "severity": "SUCCESS",
                     "display_name": "Repair invalid ToUnicode CMap information in fonts",
                     "display_comment": "Repairs syntactical problems in the ToUnicode CMap of CID fonts."
                }, {
                     "fixup_id": "FIX18",
                     "name": "FIX18",
                     "type": "fixup",
                     "count": "2",
                     "severity": "SUCCESS",
                     "display_name": "Recompress Colour Images to Zip",
                     "display_comment": ""
                }, {
                     "fixup_id": "FIX1",
                    "name": "FIX1",
                     "type": "fixup",
                     "count": "2",
                     "severity": "SUCCESS",
                     "display_name": "Convert to PDF/X-4",
                     "display_comment": "Inserts the label for PDF/X-4 into the file if it is in accordance with the requirements of this standard."
                }, {
                     "fixup_id": "FIX24",
                     "name": "FIX24",
                     "type": "fixup",
                     "count": "16",
                     "severity": "SUCCESS",
                     "display_name": "Convert Color",
                     "display_comment": "Converts colors in a PDF file so that the colors are in accordance with the requirements of PDF-based ISO standards."
                }
            ]
        }

2. Upload fixed PDF version.


3. Get the signed S3 URL.


// Request
GET {{file-base}}{{endpoint}}?type=application/pdf

 // Response
 { "url": "https://s3.amazonaws/etc/", "s3Path": "PATH-ON-S3" }

4. Capture coverS3UploadUrl and coverS3Path for later use.


var body = JSON.parse(responseBody);
pm.environment.set("coverS3UploadUrl", body.url);
pm.environment.set("coverS3Path", body.s3Path);
tests["s3UploadUrl not empty"] = body.url !== "";
tests["Status code is 200"] = responseCode.code === 200;

5. Upload the file.


Headers

Content-Type

:

application/pdf


Body

PDF file to download in Binary format 


// Request
PUT {{coverS3UploadUrl}}
 
// Response
Status Code: 200 OK

6. Add a version to cover/text file.


// Request
POST {{file-base}}/api/files/{{coverFileId}}/version
 
// Response
{
     "_id": "5f848522783fd8b659de3497",
     "createdAt": "2020-10-12T16:32:34.768Z",
     "s3Path": "5ac79ea7b0c3b91a004b7a2a/107ab898-8a72-4c73-b805-4fff0ae55fdf",
     "s3Region": "eu-west-1",
     "note": "Decrease bleed box height"
}


7. Capture file version id. 


var body = JSON.parse(responseBody);
pm.environment.set("coverFileVerId", body._id);
tests["coverFileVerId exists"] = (body._id !== "" && body._id !== undefined);
tests["Status code is 200"] = responseCode.code === 200;


8. Set active file version.


// Request
PUT {{file-base}}/api/files/{{textFileId}}/restore/{{coverFileVerId}}


9. Re-run preflight check.


10. Re-check preflight status.