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

    Introduction

    The PDF XFA Converter REST API allows your application to take a source PDF document containing XFA content as input and produce an output PDF document that has the XFA data removed. See the PDFXFARestAPI 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/pdfXfaConverters Creates and starts a new PDF XFA Converter process.
    GET https://api.accusoft.com/imageGear/api/v1/pdfXfaConverters/{processId} Gets the state of an existing PDF XFA Converter process.

    POST /imageGear/api/v1/pdfXfaConverters

    Creates and starts a new PDF XFA Converter process.

    A PDF XFA Converter represents a process that runs on the server and removes XFA data from a PDF document.

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

    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 processed. 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/pdfXfaConverters
    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/pdfXfaConverters/{processId}

    Gets the state and result of an existing PDF XFA Converter process created by POST /imageGear/api/v1/pdfXfaConverters.

    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 PDF XFA Converter process.

    Response Body

    JSON object with the following properties:

    • input (Object) A copy of the POST /imageGear/api/v1/pdfXfaConverters](#post-imagegearapiv1ipdfxfaconverters) 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 processed. 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" Process specified by {processId} has expired.
    404 "ResourceNotFound" Process specified by {processId} could not be found.
    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/pdfXfaConverters/iFhSZRvrz2vtFjcTSi9Qlg
    

    Successful Response

    When the 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 process does not exist for the given processId:

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

    Response when a 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 server encountered an internal error when handling the request:

    HTTP 580 OK
    Content-Type: application/json
    {
      "input": {
        "source": {
          "fileId": "ek5Zb123oYHSUEVx1bUrVQ"
        }
      },
      "processId": "iFhSZRvrz2vtFjcTSi9Qlg",
      "state": "error",
      "errorCode": "InternalError",
      "errorDetails": {
        "in": "process",
        "at": "input.source.fileId",
      },
      "expirationDateTime": "2019-02-07T13:24:35.395Z"
    }