Endpoint /documentprocessing/document/append

POST https://example.com/documentprocessing/document/append

POST

Combines documents by appending them divided by a new section, paragraph or nothing.

Examples

The following example appends to given documents to create one resulting PDF.

# Request:
curl --location --request POST 'https://trial.dsserver.io/documentprocessing/document/append?returnFormat=PDF' \
    --header 'Content-Type: application/json' \
    --header 'Authorization: Bearer GphAd1R0npJM9OuX2y9mUa4cfqPMOg6p' \
    --data-raw '{
        "documents":[
            {
                "document": "UEsDBBQAAAAIAAACAAC5EQAA[..]="
            },
            {
                "document": "JVBERi0xLjQKMSAwIG9iago8[..]",
                "documentDivider": 1
            }
        ]
    }'

# Result:
"UEsDBBQAAAAIAAACAAC5EQAAAAADKSKHJHDuHD[..]"

Authorization

This endpoint supports the OAuth authorization method:

OAuth

DS Server implements OAuth as the authorization method. Two flows are supported:

  • Authorization Code
  • Client Credentials

In order to use the Client Credentials flow, this method must be explicitly enabled in the admin portal of DS Server.

In both cases, a valid access token returned from the OAuth endpoints must be passed in a Bearer Authorization Header or as a Query Parameter.

Authorization Header

Header Field Description
Authorization

A Bearer authorization header (also called token authentication) contains the OAuth access token. The authorization method and a space i.e. "Bearer " is then put before your valid access token. For example:

Authorization: Bearer 4796E23054E64BC773CACBCAF24AD179DE9A3

Query Parameter

Query Parameter Description
access_token

The access token is passed directly in the endpoint URL as a query string. For example:

?access_token=4796E23054E64BC773CACBCAF24AD179DE9A3

Request Parameters

Name Type Value Optional
returnFormat String A string that specifies the format of the created document. Possible values are: "PDF", "PDFA", "RTF", "DOC", "DOCX", "HTML" and "TX". Default value is "PDF". yes

Request Payload

Type Value
AppendBody The AppendBody object contains the templates encoded as a Base64 strings and a DocumentSettings object.

AppendBody

Name Type Value Optional
documents AppendDocument The documents that are appended including divider options. no
documentSettings DocumentSettings Document settings to specify document properties such as title and author. yes

AppendDocument

Name Type Value Optional
document String The document as a Base64 encoded string. no
documentDivider Integer The document divider option. Possible values: 1 (None), 2 (NewParagraph), 3 (NewSection). yes

DocumentSettings

Name Type Value Optional
author String Sets the document's author. yes
creationDate DateTime (String) Sets the document's creation date which will be saved in the document. yes
lastModificationDate DateTime (String) Sets the date the document is last modified. yes
creatorApplication String Sets the application, which has created the document. yes
documentSubject String Sets the document's subject string which will be saved in the document. PDF limitation: The length is limited to 2000 characters. yes
documentTitle String Sets the document's title that will be saved in the document. PDF limitation: The length is limited to 2000 characters. yes
userPassword String Specifies the password for the user to open the document. yes

Success Response

Status Description
200 On success, the HTTP status code in the response header is 200 (OK). The response body contains the resulting document encoded as a Base64 encoded string.

Error Response

Status Description
401 A 401 (Unauthorized) is returned, if the user is not authorized.
400 A 400 (Bad Request) is returned, if DS Server is not licensed or the license is invalid.
400 A 400 (Bad Request) is returned, if no data is found in the AppendBody object.
400 A 400 (Bad Request) is returned, if no documents were found in the AppendBody object.
400 A 400 (Bad Request) is returned, if the uploaded document is not valid.