Add structured input endpoint examples - #131
datalogics-tsmith merged 11 commits into
Conversation
- Add JSON and multipart examples for Markdown, CSV, JSON, XML, and plain text conversion. - Demonstrate resource uploads, structured options, Markdown image mapping, table styling, and tagged output. Assisted-by: Codex
- Add JSON and multipart examples for Markdown, CSV, JSON, XML, and plain text conversion. - Demonstrate resource uploads, structured options, Markdown image mapping, table styling, and tagged output. Assisted-by: Codex
- Add JSON and multipart examples for Markdown, CSV, JSON, XML, and plain text conversion. - Demonstrate resource uploads, structured options, Markdown image mapping, table styling, and tagged output. Assisted-by: Codex
- Add JSON and multipart examples for Markdown, CSV, JSON, XML, and plain text conversion. - Demonstrate resource uploads, structured options, Markdown image mapping, table styling, and tagged output. Assisted-by: Codex
- Add JSON and multipart examples for Markdown, CSV, JSON, XML, and plain text conversion. - Demonstrate resource uploads, structured options, Markdown image mapping, table styling, and tagged output. Assisted-by: Codex
- Add JSON and multipart examples for Markdown, CSV, JSON, XML, and plain text conversion. - Demonstrate resource uploads, structured options, Markdown image mapping, table styling, tagged output, and dispatcher commands. Assisted-by: Codex
- Apply the repository Spotless and Google Java Format rules to the new JSON and multipart examples. - Remove unused imports and normalize wrapped declarations so Maven verify accepts the added samples in CI. Assisted-by: Codex
- Use repository-standard API URL, placeholder key, and local path setup. - Restore regional endpoint comments across the new language samples. - Keep Java dotenv and .NET configuration patterns consistent with their existing folders. Assisted-by: Codex
|
Addressed in commit The new endpoint examples now match the established samples in their respective language folders: cURL, Python, JavaScript, and PHP use the standard API URL and placeholder API key in the request setup, fixed Validation completed locally: all 40 normalized cURL, Python, JavaScript, and PHP samples passed syntax checks; both Java endpoint projects passed Spotless and Maven tests under JDK 17; and the .NET project built successfully with its existing warnings only. |
- Use the repository-standard .txt extension in Python and JavaScript structured text examples. - Keep both JSON-resource and multipart plain text examples runnable with the documented sample input. Assisted-by: Codex
|
Addressed in commit The Python and JavaScript plain-text examples were using I also ran the complete current 60-example matrix locally against pdfRest: 5 formats × 2 payload styles × 6 languages. All 60 requests succeeded, every returned PDF downloaded successfully, and all 60 PDFs passed |
- Name the Markdown, CSV, JSON, XML, and plain text input format in each sample description. - Keep the JSON-resource and multipart sample comments consistent. Assisted-by: Codex
- Add axios for JSON-resource requests. - Add form-data for multipart requests. - Regenerate the root lockfile so a clean npm install resolves both dependencies. Assisted-by: Codex
|
Addressed in commit The .NET structured-input examples now identify their actual input format in the |
|
Addressed in commit The root |
Why this change
The Convert to PDF endpoint now supports structured text inputs, but the endpoint examples did not yet make those workflows easy to discover across the primary languages. This change gives developers complete examples for the supported structured formats and shows how to use the same endpoint with either an uploaded file or a previously uploaded resource.
What changed
Added endpoint examples for Markdown, CSV, JSON, XML, and plain text in cURL, Python, JavaScript, PHP, Java, and .NET. Each format has both JSON-resource and multipart examples.
The Markdown examples include page setup, styling, table formatting, tagged output, and image mapping. The JSON-resource variant uploads the Markdown image first and maps it through
image_ids; the multipart variant maps an uploaded image throughimage_files. The .NET dispatcher includes commands for all new examples.Behavior changes
The JSON-resource examples upload the source file before calling
/pdfand pass the resulting resource ID in the JSON payload. Multipart examples send the source file andstructured_text_optionsin one/pdfrequest. All examples print the API response, including output and input resource IDs where returned.The examples enable tagging so the generated PDFs demonstrate tagged output. Format-specific options are limited to the formats where they apply: Markdown image mapping, CSV table configuration, JSON/XML hierarchy presentation, and plain-text line preservation.
Validation
All 60 examples were executed against the pdfRest service using the same five representative inputs. Every request succeeded. The 60 returned PDFs passed
qpdf --check, and extracted text matched across all six languages and both payload styles for each format. Representative Markdown, CSV, JSON, XML, and plain-text PDFs were rendered and visually inspected.Static validation passed for Python, JavaScript, cURL, PHP, .NET, and Java. No secrets or machine-specific paths are included.
Risks and follow-ups
There are no API behavior or compatibility changes in this repository; this PR adds examples only. The cURL, Python, JavaScript, and PHP samples follow the established endpoint-example convention of using placeholder API keys and local paths in the source. Java retains the existing default API-key constant with optional dotenv lookup, and .NET retains its repository-standard environment-variable configuration and dispatcher arguments. Users replace the placeholders before running the samples.