gitlabEdit

โ˜•Java SDK

Official Java client library for the Docs-Dispatcher API. Generate documents (DOCX, XLSX, PPTX, PDF, HTML, images) from templates, send emails, SMS, postal mail, or compose multiple services together.

Requirements

  • Java: 1.8 or later

  • Build Tools: Maven 3.8.3+ or Gradle 7.2+

Installation

Maven

Add this dependency to your project's pom.xml:

<dependency>
  <groupId>io.docs-dispatcher</groupId>
  <artifactId>docsdispatcher-java-client</artifactId>
  <version>0.0.1</version>
</dependency>

Gradle

Add this dependency to your build.gradle:

Building from Source

Clone the repository and install locally:

Quick Start

Authentication Setup

All API calls (except health checks) require a Bearer token for authentication. Obtain your API token from the Docs-Dispatcher dashboardarrow-up-right.

circle-info

Get Your API Token: Log in to the Docs-Dispatcher dashboardarrow-up-right and navigate to Settings โ†’ API Tokens to generate a new token.

Check API Status

Verify the API is healthy and accessible:

Service Examples

Generate a Document

Generate a PDF, DOCX, or other document from a template:

Supported Formats:

  • PDF

  • DOCX (Microsoft Word)

  • XLSX (Microsoft Excel)

  • PPTX (Microsoft PowerPoint)

  • HTML

  • PNG/JPG/SVG images

See Template Managementarrow-up-right for template creation.

Send an Email

Send an email with generated attachments:

Send an SMS

Send SMS messages via configured providers:

Supported Providers:

Create an Invoice

Generate invoices, quotes, or credit notes:

Invoice Providers:

  • ipaidthat: French invoicing platform

  • qonto: European business banking

  • stripe: Payment processing with invoicing

See Invoice Providersarrow-up-right for configuration details.

E-Signature Workflow

Request electronic signatures:

Signature Types:

  • SIMPLE: Basic electronic signature

  • ADVANCED: Identity-verified signature

  • QUALIFIED: Legally binding qualified signature (eIDAS compliant)

See E-Signature Providersarrow-up-right for provider configuration.

Advanced Features

List Available Configurations

Get all available configurations for your account:

Validate a Request

Validate a request before dispatching to catch errors early:

Service Composition

Compose multiple services in a single API call:

Composition Patterns:

  • Generate + Email: dispatchersDispatchWithOneComposable(FILE, EMAIL, request)

  • Generate + Email + Upload: dispatchersDispatchWithTwoComposable(FILE, EMAIL, UPLOAD, request)

API Reference

Available Services

The Service enum defines the available dispatcher services:

Service
Description

FILE

Generate documents from templates

EMAIL

Send emails with generated attachments

SMS

Send SMS messages

POSTAL

Send postal mail

UPLOAD

Upload files to storage

ESIGN

Electronic signature requests

INVOICING

Generate invoices

API Classes

Class
Description

ApiStatusApi

Health check endpoints

EndUserApiApi

Main API for document generation and service dispatch

ConfigurationsHelpersApi

Configuration management and validation

RequestValidationApi

Request validation utilities

ExternalServicesWebhooksApi

Webhook handling for external services

Endpoints

All URIs are relative to https://api.docs-dispatcher.io

Class
Method
HTTP Request
Description

ApiStatusApi

applicationLiveness

GET /healthz

Get API liveness status

ConfigurationsHelpersApi

configurationsList

GET /api/configurations

List all supported configurations

ConfigurationsHelpersApi

configurationsGetConfiguration

GET /api/configurations/{configTypeName}/config

Get configuration for a config type

ConfigurationsHelpersApi

configurationsListProviders

GET /api/configurations/{configTypeName}/providers

List providers for a config type

ConfigurationsHelpersApi

configurationsValidateConfiguration

POST /api/configurations/{configTypeName}/validate

Validate a configuration

EndUserApiApi

dispatchersDispatch

POST /api/{dispatcherService}

Dispatch a service request

EndUserApiApi

dispatchersDispatchWithOneComposable

POST /api/{dispatcherService}/{composableService1}

Compose two services

EndUserApiApi

dispatchersDispatchWithTwoComposable

POST /api/{dispatcherService}/{composableService1}/{composableService2}

Compose three services

EndUserApiApi

dispatchersValidateRequest

POST /api/{dispatcherService}/validate

Validate a service request

Error Handling

The SDK throws ApiException for all API errors. The exception provides:

  • getCode() - HTTP status code

  • getResponseBody() - Error response body

  • getResponseHeaders() - Response headers

Common Error Codes

Code
Description

400

Bad request - invalid data or missing parameters

401

Unauthorized - invalid or missing API token

403

Forbidden - insufficient permissions

404

Not found - template or configuration not found

415

Unsupported media type

417

Missing required parameters

500

Internal server error

501

Service not implemented

Error Handling Example

See Troubleshooting for common errors and solutions.

Thread Safety

circle-exclamation

Dependencies

This SDK uses the following libraries:

  • OkHttp 4.12.0: HTTP client

  • Gson 2.10.1: JSON serialization

  • Gson Fire 1.9.0: Gson extensions

All dependencies are automatically managed by Maven or Gradle.

Configuration

Custom Base Path

Override the default API endpoint:

Custom HTTP Client

Configure the underlying OkHttp client:

Logging and Debugging

Enable debug logging:

Framework Integration

Spring Boot

Jakarta EE

Documentation

Repository

Next Steps

Configure Providers

Troubleshoot Issues

Support

License

This project is licensed under the Unlicense - see the LICENSEarrow-up-right file for details.

Last updated