ReportingCloud

POST /v1/document/append

Endpoint

POST https://api.reporting.cloud/v1/document/append

Description

Combines several documents into one. The request body lists the documents, each as a Base64 string with the divider that separates it from the document before: none, a new paragraph or a new section. The response is the combined document as a Base64 string, in the format returnFormat names, PDF by default. See Appending Documents.

Warning

Document Quota. Each successful request counts 1 against the document quota. It counts 1 also when it combines several documents. A test run (test=true) doesn't count. Plans and Licensing lists the quota of each plan.

Examples

Request:

curl \
  -u username:password \
  -H "Content-Type: application/json" \
  --data "{
        \"documents\":[
          {
              \"document\": \"UEsDBBQAAAAIAAACAAC5EQAAAAA=\",
              \"documentDivider\": 1
          },
          {
              \"document\": \"UEsDBBQAAAAIAAACAAC5EQAAAAA=\",
              \"documentDivider\": 2
          }
      ],
      \"documentSettings\":{
          \"author\": \"Text Control GmbH\",
          \"creationDate\": null,
          \"creatorApplication\": null,
          \"documentSubject\": null,
          \"documentTitle\": null,
          \"lastModificationDate\": null,
          \"userPassword\": null
      }

  }" \
  -X POST "https://api.reporting.cloud/v1/document/append?returnFormat=PDF"

Results:

"JVBERi0xLjQNJeLjz9MNMSAwIG9iago8PAovVH..."

Authorization

This endpoint requires a "ReportingCloud-APIKey" or a "Basic" user authorization to access the user account, data and templates. Only one of these two methods is required.

API Keys describes how to create an API key, and Authentication explains both header forms.

ReportingCloud-APIKey

Header fieldDescription
AuthorizationRequired. A valid ReportingCloud account is required. The Authorization field is constructed as follows: An API key needs to be generated in the portal or with PUT /v1/account/apikey. The authorization method and a space, "ReportingCloud-APIKey ", is then put before the actual API key string. For example: Authorization: ReportingCloud-APIKey oMDM4MrAqL9QEOpyzupnQW5NjvCNtvE5cVDaaLqxI

Basic

Header fieldDescription
AuthorizationRequired. A valid ReportingCloud account is required. The Authorization field is constructed as follows: The user name and password are combined into a string separated by a colon, for example username:password. The resulting string is encoded using the RFC2045-MIME variant of Base64, except not limited to 76 char/line. The authorization method and a space, "Basic ", is then put before the encoded string. For example: Authorization: Basic QWxhZGRpbjpPcGVuU2VzYW1l

Request Parameters

NameTypeValueOptional
returnFormatStringA string that specifies the format of the created document. Possible values are: PDF, PDFA, RTF, DOC, DOCX, HTML, TXT and TX, in any letter case. The default value is PDF. PDFA requires an Extreme license.yes
testBooleanSpecifies whether it is a test run or not. A test run is not counted against the quota, and the created document contains a "TEST MODE" watermark. A PDF or DOCX gets the title "ReportingCloud Test Mode" in place of the documentTitle. Not possible using the Free license. The default value is false.yes

Request Payload

TypeValue
AppendBodyThe AppendBody object contains the documents encoded as Base64 strings and a ReportingCloud DocumentSettings object.

AppendBody

NameTypeValueOptional
documentsArray of ReportingCloud AppendDocument objectsThe documents that are appended including divider options.no
documentSettingsReportingCloud DocumentSettings objectDocument settings to specify document properties such as title and author.yes

AppendDocument

NameTypeValueOptional
documentStringThe document as a Base64 encoded string. Possible document formats are RTF, DOC, DOCX, HTML, PDF, TX, XLSX and plain text.no
documentDividerIntegerThe divider between this document and the one before it, ignored for the first document. Possible values: 1 (None), 2 (NewParagraph), 3 (NewSection). Left out or given any other integer, the document is appended without a divider, as with 1.yes

DocumentSettings

NameTypeValueOptional
authorStringSets the document's author.yes
creationDateDateTime (String)Sets the document's creation date which will be saved in the document.yes
lastModificationDateDateTime (String)Sets the date the document is last modified.yes
creatorApplicationStringSets the application, which has created the document.yes
documentSubjectStringSets the document's subject string which will be saved in the document.yes
documentTitleStringSets the document's title that will be saved in the document.yes
userPasswordStringSpecifies the password for the user to open the document.yes

Success Response

StatusDescription
200On 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

StatusDescription
400A 400 (Bad Request) is returned, if the request has no body, documents is left out or null, a document is left out or is not a valid Base64 string or returnFormat is not one of the possible values. An empty documents array is not an error: the response is an empty string.
403A 403 (Forbidden) is returned, if the user is not authorized, the document quota is exceeded or the return format PDFA is requested without an Extreme license.
405A 405 (Method Not Allowed) is returned, if the request uses another HTTP method than POST. The Allow header of the response names POST.
411A 411 (Length Required) is returned, if the request has neither a body nor a Content-Length header.
415A 415 (Unsupported Media Type) is returned, if the request has a body but no Content-Type header, or a Content-Type such as text/plain that the endpoint doesn't read. Send Content-Type: application/json.
500A 500 (Internal Server Error) is returned, if the request has no Authorization header, an empty one or one that is not the authorization method, a space and the credentials, or if the body is null, the body doesn't have the shape of an AppendBody object or returnFormat is empty.

Timeout Limitation. The pure processing time is limited to a maximum of 60 seconds. After this period of time, the task is canceled.

A typical document should not take more than 5 seconds. If your request takes longer, append fewer documents, or smaller ones.