Loading page...Загружаем страницу...正在加载页面...
AtlasRepo

Single and Multiple Document Generation Aren't the Same Endpoint With an Array Bolted On

Описание и применение

Разработчики, пытающиеся пакетно генерировать документы, ошибочно используют одиночный эндпоинт PDF4me, что приводит к ошибкам. Переключение на специальный эндпоинт Generate Documents (Multiple) с правильной структурой запроса и ответа позволяет обрабатывать несколько записей за один вызов, получая JSON‑массив с файлами.

Задача

Developers assume batch document generation can be done by adding an array to the single-document endpoint, but the PDF4me API requires a distinct endpoint with different input and output requirements.

Результат

Switching to the correct batch endpoint eliminates 404 errors, supports batch data formats, and provides a structured JSON response with per-file metadata, enabling automated handling of multiple documents.

Рабочий процесс

  • 1. Identify the correct endpoint: POST /api/v2/GenerateDocumentMultiple
  • 2. Prepare payload with templateFileType (Docx, HTML, PDF), templateFileName, templateFileData, documentDataType (Json or XML), and documentDataText as an array of records
  • 3. Set outputType (PDF, Docx, or optional xlsx for Docx/PDF templates)
  • 4. Send POST request with Authorization header
  • 5. Parse JSON response: iterate over outputDocuments array, extract fileName and base64 streamFile (or fileContent/content/data)
  • 6. Decode base64 and write each file to disk or further processing

Доказательства

Generate Documents (Multiple) is a separate endpoint, with a narrower set of accepted inputs, one output format Single cannot touch at all, and a response envelope shaped nothing like the one Single returns.

Источник

Single lives at POST /api/v2/GenerateDocumentSingle. The batch version, despite its own docs page being titled "Generate Documents (Multiple)", lives at POST /api/v2/GenerateDocumentMultiple, singular Document, no trailing s.

Источник

  • Дата записи: 2026-09-15T10:45:57.055Z