Data Structures

Conversion Manifest

Description

The specifics of your file conversion, including a description of all of the input files and the desired output file.  This can be represented as either XML or JSON, and examples of both are provided below.

Example (XML)

<conversion>
  <outputFormat>application/pdf</outputFormat>
  <outputDimensions>
    <widthInPoints>612</widthInPoints>
    <heightInPoints>792</heightInPoints>
  </outputDimensions>
  <conversionFiles>
    <conversionFile>
      <uri>fileId:53235</uri>
      <index>0</index>
      <mimeType>application/pdf</mimeType>
    </conversionFile>
    <conversionFile>
      <uri>fileId:53783</uri>
      <index>1</index>
      <mimeType>application/msword</mimeType>
    </conversionFile>
  </conversionFiles>
  <customField>JobIdentifier12345</customField>
  <callback>
    <url>http://www.mydomain.com/publish/convert/notification_url.php</url>
    <mimeType>application/xml</mimeType>
  </callback>
</conversion>
    

Example (JSON)

{
  "outputFormat": "application/pdf",
  "outputDimensions": {
    "widthInPoints": 612,
    "heightInPoints": 792
  },
  "conversionFiles": [{
      "uri": "fileId:53235",
      "index": 0,
      "mimeType": "application/pdf"
    }, {
      "uri": "fileId:53783",
      "index": 1,
      "mimeType": "application/msword"
    }
  ],
  "customField": "JobIdentifier12345",
  "callback": {
    "url": "http://www.mydomain.com/publish/convert/notification_url.php",
    "mimeType": "application/json"
  }
}
    

Fields

Field Data Type Required? Description
outputFormat string yes The type of file that should be generated as a MIME type. Currently the only supported output format is "application/pdf".
outputDimensions data structure yes for PDF output The width and height, in points, of the output file.
conversionFiles list of data structures yes Specifies the location, type, and order of the inputs to conversion.
customField string no An optional arbitrary string attached to the job. Can be used to identify the source or context of a conversion when notified of its completion.
callback data structure no If supplied, the conversion system will POST a notification when the conversion job completes successfully or encounters an error.

Output Dimensions

Description

The output dimensions are specified in points. For example, an 8.5"x11" page size would be specified using the dimensions 612x792. Any input file pages that are not the specified size will be resized during the conversion process. For optimal results, it is recommended that properly sized files be provided to avoid resizing..

Fields

Field Data Type Required? Description
widthInPoints integer yes The page width in points.
heightInPoints integer yes The page height in points.

Source Files

Description

A representation of a single file to be converted and concatenated into the resulting file.  The location of each file is specified using a custom URI that identifies a file that has been previously uploaded into your files. See the upload call for more information about uploading files and obtaining the corresponding file identifier.

Fields

Field Data Type Required? Description
uri string yes The ID of the uploaded source file, with a URI scheme of "fileId". For example, "fileId:5678".
mimeType string yes The format of the file, specified using a MIME type.
index integer yes The order of this file in relation to the others. This value must start at 0 and the source file IDs must be consecutive numbers.

Callback

Description

A callback URL can be specified in order to be notified of a completed conversion, whether successful or in error. The notification will be POSTed with a POST body equivalent to the response of a status call.

Fields

Field Data Type Required? Description
url string yes The URL to which to POST.
mimeType string yes Format of the notification. Can be "application/xml" or "application/json".

Conversion Status

Description

Document conversion is an asynchronous process.  When a conversion is begun the job is queued and a status is returned immediately.  This structure includes information about each document in the conversion request as well as an overall status of the job.

Example (XML)

In this example, a job is currently undergoing conversion. Given two input files, one of them has been completed (with a notification that it was resized to the output dimensions), while the other is awaiting conversion.

<conversion>
  <conversionId>12345</conversionId>
  <status>CONVERTING</status>
  <outputFileId/>
  <conversionStartDate>2011-01-31T14:16:37.782-05:00</conversionStartDate>
  <outputFormat>application/pdf</outputFormat>
  <outputDimensions>
    <heightInPoints>750.0</heightInPoints>
    <widthInPoints>750.0</widthInPoints>
  </outputDimensions>
  <customField>JobIdentifier12345</customField>
  <callback>
    <url>http://www.mydomain.com/publish/convert/notification_url.php</url>
    <mimeType>application/xml</mimeType>
  </callback>
  <conversionFiles>
    <conversionFile>
      <conversionFileId>34567</conversionFileId>
      <uri>fileId:53235</uri>
      <index>0</index>
      <status>COMPLETED</status>
      <notifications>
        <notification>
          <text>File was resized to the requested output dimensions</text>
          <severity>WARNING</severity>
          <code>1100000004</code>
        </notification>
      </notifications>
      <mimeType>application/pdf</mimeType>
      <downloadStartDate>2011-01-31T14:16:37.822-05:00</downloadStartDate>
      <downloadEndDate>2011-01-31T14:16:37.851-05:00</downloadEndDate>
      <conversionStartDate>2011-01-31T14:16:37.871-05:00</conversionStartDate>
      <conversionEndDate>2011-01-31T14:16:37.897-05:00</conversionEndDate>
    </conversionFile>
    <conversionFile>
      <conversionFileId>34568</conversionFileId>
      <uri>fileId:53783</uri>
      <index>1</index>
      <status>QUEUED_FOR_CONVERSION</status>
      <mimeType>application/pdf</mimeType>
      <downloadStartDate>2011-01-31T14:16:37.830-05:00</downloadStartDate>
      <downloadEndDate>2011-01-31T14:16:37.832-05:00</downloadEndDate>
    </conversionFile>
  </conversionFiles>
</conversion>
    

Example (JSON)

{
   "conversion":{
      "conversionId":12345,
      "status":"CONVERTING",
      "outputFileId":null,
      "notifications":[],
      "conversionStartDate":"2011-01-31T14:16:37-05:00",
      "manifestId":23456,
      "outputFormat":"application/pdf",
      "outputDimensions":{
         "widthInPoints":750.0,
         "heightInPoints":750.0
      },
      "customField":"jobIdentifier12345",
      "conversionFiles":[
         {
            "conversionFileId":34567,
            "uri":"fileId:53235",
            "index":0,
            "status":"COMPLETED",
            "notifications": [{
               "text": "File was resized to the requested output dimensions",
               "details": null,
               "severity": "WARNING",
               "code":1100000004}],
            }],
            "mimeType":"application/pdf",
            "downloadStartDate":"2011-01-31T14:16:37-05:00",
            "downloadEndDate":"2011-01-31T14:16:37-05:00",
            "conversionStartDate":"2011-01-31T14:16:37-05:00",
            "conversionEndDate":"2011-01-31T14:16:37-05:00"
         },
         {
            "conversionFileId":34568,
            "uri":"fileId:53783",
            "index":1,
            "status":"QUEUED_FOR_CONVERSION",
            "mimeType":"application/pdf",
            "downloadStartDate":"2011-01-31T14:16:37-05:00",
            "downloadEndDate":"2011-01-31T14:16:37-05:00"
         }
      ]
   }
    }

Fields

The response consists of the elements from the conversion manifest with a few additional fields added.  The fields may not be included in the response if they are not relevant. For example, if the conversion has not yet completed, the "conversionEndDate" and "outputFileId" fields may not appear.

Field Data Type Description
conversionId integer The unique identifier for this job.
status string Status code that describes the current state of the conversion job.
outputFileId string The ID of the file produced by the completed conversion.
notifications list of data structures A set of conversion errors or warnings, following the standard structure for notifications.
conversionStartDate string The timestamp of the start of the conversion.
conversionEndDate string The timestamp of the end of the conversion.
conversionFile / status string

Status code that describes the current state of an individual file in the job

conversionFile / notifications

list of data structures

A set of conversion errors or warnings for an individual file in the job, following the standard structure for notifications.

6 Comments

  1. Paul2 years ago

    which mimeTypes are supported?

  2. Josiah Gore2 years ago

    The supported input mime types are

    • microsoft word DOC - application/msword
    • DOCX - application/vnd.openxmlformats-officedocument.wordprocessingml.document
    • RTF - application/rtf
    • openoffice ODT - application/vnd.oasis.opendocument.text

    The supported output formats are

    • PDF - application/pdf
    • ePub - application/epub+zip
  3. Spiro1 year ago

    Once a file is converted do I use its former id to include it in my project or which id shall I use?

  4. Ryan Bloom1 year ago

    Once a file is converted, you should include the output fileid from the conversion. Do not include the original id.

  5. Spiro1 year ago

    Missing Documentation!

    Ryan Bloom

    Once a file is converted, you should include the output fileid from the conversion. Do not include the original id.

    As Ryan Bloom states, the following is missing from the Conversion Status documentation:

    Right after the conversionFiles field comes another field called outputFileId, this is the one that must be used within the project's creation structure as the content file's id.

    While the conversion is not completed outputFileId will return NULL, once it is marked as completed it will come back with a valid value.

  6. Josiah Gore1 year ago

    Thanks for bringing this to our attention. I've updated the documentation to include the outputFileId in the data structure.

Please sign in to post a comment.