ImageGear v26.5 - Updated
API Reference / PDF to PDF/A Converter REST API
In This Topic
    PDF to PDF/A Converter REST API
    In This Topic

    Introduction

    The PDF to PDF/A Converter REST API allows your application to take a source PDF document as input and produce an output PDF document that is PDF/A compliant. See the PDFtoPDFARestAPI Sample for an example on how to use the API in an application.

    Available URLs

    URL Description
    POST https://api.accusoft.com/imageGear/api/v1/pdfToPdfaConverters Creates and starts a new PDF to PDF/A Converter process.
    GET https://api.accusoft.com/imageGear/api/v1/pdfToPdfaConverters/{processId} Gets the state of an existing PDF to PDF/A Converter process.

    POST /imageGear/api/v1/pdfToPdfaConverters

    Creates and starts a new PDF to PDF/A Converter process.

    A PDF to PDF/A Converter represents a process that runs on the server and converts a PDF document to a PDF/A compliant document.

    The server process to convert PDF documents is started by this request, but a response is sent before the process is complete. Use the GET /imageGear/api/v1/pdfToPdfaConverters/{processId} URL below to get the state and results of an in-progress or completed PDF to PDF/A Converter process.

    1. The PDF to PDF/A Converter currently supports the following conversions:

      • PDF to PDF/A-2b conformance level

    Request

    Request Headers

    Name Description
    Content-Type Must be application/json

    Request Body

    JSON object conforming to the following:

    • input
      • source (Object) Required. An object that defines the source document.
        • fileId (String) Required. The ID of the work file which represents the source document that will be converted. See the Work File API topic to find out how to upload a work file.
    • minSecondsAvailable (Integer) The minimum number of seconds this process status will remain available via a GET request. The actual lifetime may be longer. The default lifetime is defined by the processIds.lifetime [central configuration] parameter.

    Successful Response

    Response Body

    JSON object with the following properties:

    • input (Object) A copy of the request body input object.
    • processId (String) The id of the new process.
    • expirationDateTime (String) The date and time (in ISO 8601 Extended Format) when the process will be deleted.
    • state (String) The current state of the process running on the server. The response will always be "processing".

    Error Responses

    Status Code JSON errorCode Description
    480 "MissingInput" A required input value was not provided. See errorDetails in the response body.
    480 "InvalidInput" An invalid input value was used. See errorDetails in the response body.
    480 "UnrecognizedInput" An unrecognized JSON property was provided. See errorDetails in the response body.
    480 "ResourceNotFound" Source document work file does not exist. See errorDetails in the response body.
    580 "InternalError" The server encountered an internal error when handling the request.

    Example

    Request

    POST /imageGear/api/v1/pdfToPdfaConverters
    Content-Type: application/json
    {
      "input": {
        "source": {
          "fileId": "ek5Zb123oYHSUEVx1bUrVQ"
        }
      },
      "minSecondsAvailable": 60
    }
    

    Response

    HTTP 200 OK
    Content-Type: application/json
    {
      "processId": "iFhSZRvrz2vtFjcTSi9Qlg",
      "expirationDateTime": "2019-02-07T13:24:35.395Z",
      "input": {
        "source": {
          "fileId": "hl6Ac234pZITVFWy2cVsWR"
        }
      },
      "state": "processing"
    }
    
    

    GET /imageGear/api/v1/pdfToPdfaConverters/{processId}

    Gets the state and result of an existing PDF to PDF/A Converter process created by POST /imageGear/api/v1/pdfToPdfaConverters.

    Requests can be sent to this URL repeatedly while the state is "processing".

    When the state is "complete" the response will include the work file id of the processed output document.

    If the process encounters an error, the state property will be "error" and the errorCode property will contain an error code string.

    Request

    Parameters

    Parameter Description
    {processId} The id of the process.

    Response Body

    JSON object with the following properties:

    • input (Object) A copy of the POST /imageGear/api/v1/pdfToPdfaConverters](#post-imagegearapiv1ipdftpdfaconverters) request body input object accepted to create the process.
    • processId (String) The id of the process.
    • expirationDateTime (String) The date and time (in ISO 8601 Extended Format) when the process will be deleted.
    • state (String) The current state of the process running on the server. The following values are allowed:
      • "processing" - The process is in progress.
      • "complete" - The process is completed.
      • "error" - The process returned an error.
    • errorCode (String) An error code string if a problem occurred during the process. Only present when state is "error".
    • output (Object) Describes the output document. Only present when state is "complete".
      • fileId (String) The ID of the work file which represents the source document that was converted. See the Work File API topic to find out how to download a work file.

    Error Responses and JSON Error Codes

    Status Code JSON errorCode Description
    410 "ResourceExpired" The process specified by {processId} has expired.
    404 "ResourceNotFound" The process specified by {processId} could not be found.
    200 SourceCannotBeConformed" The provided document was not able to be converted to the targeted output PDF conformance level.
    200 "UnsupportedFileFormat" The file format of the provided source document is not supported.
    580 "InternalError" The server encountered an internal error when handling the request.

    Example

    Request

    GET /imageGear/api/v1/pdfToPdfaConverters/iFhSZRvrz2vtFjcTSi9Qlg
    

    Successful Response

    When the PDF to PDF/A Converter process completes with no errors:

    HTTP 200 OK
    Content-Type: application/json
    {
      "input": {
        "source": {
          "fileId": "ek5Zb123oYHSUEVx1bUrVQ"
        }
      },
      "processId": "iFhSZRvrz2vtFjcTSi9Qlg",
      "expirationDateTime": "2019-02-05T13:24:35.395Z",
      "state": "complete",
      "output": {
        "fileId": "fl6Ac234pZITVFWy2cVsWR"
      }
    }
    

    Error Responses

    Response when a PDF to PDF/A Converter process does not exist for the given processId:

    HTTP 404
    Content-Type: application/json
    {
      "errorCode": "ResourceNotFound",
      "errorDetails": {
        "in": "url",
        "at": "processId",
      },
    }
    

    Response when a PDF to PDF/A Converter process did exist for the given processId, but has passed its expiration time:

    HTTP 410
    Content-Type: application/json
    {
      "errorCode": "ResourceExpired",
      "errorDetails": {
        "in": "url",
        "at": "processId",
      },
    }
    

    Response when the source document was not able to be converted to the desired PDF/A compliance level:

    HTTP 200 OK
    Content-Type: application/json
    {
      "input": {
        "source": {
          "fileId": "ek5Zb123oYHSUEVx1bUrVQ"
        }
      },
      "processId": "iFhSZRvrz2vtFjcTSi9Qlg",
      "state": "error",
      "errorCode": "SourceCannotBeConformed",
      "errorDetails": {
        "in": "process",
        "at": "input.source.fileId",
        "description": "XFA is not compatible with PDF/A"
      },
      "expirationDateTime": "2019-02-07T13:24:35.395Z"
    }