Skip to content

Support Carbone API v5 (SDK 3.0.0) - #18

Merged
guillaume-carbone merged 1 commit into
masterfrom
feat/v5
Oct 26, 2026
Merged

guillaume-carbone merged 1 commit into
masterfrom
feat/v5

Conversation

@guillaume-carbone

@guillaume-carbone guillaume-carbone commented Oct 26, 2026 •

Copy link
Copy Markdown
Member

Summary

Adds support for the Carbone API v5 and makes it the default. This is released as SDK 3.0.0. Existing ICarboneServices methods are unchanged.

Breaking changes

  • Requests send carbone-version: 5 by default (was 4). To keep v4, call create(token, "4").
  • New methods were added to ICarboneServices, ICarboneTemplateClient and ICarboneRenderClient. This only affects code that implements these interfaces itself.

New features

Feature API
Versioned templates and metadata addTemplate(file, CarboneTemplateOptions) returns a CarboneTemplate (Template ID id, Version ID versionId). CarboneTemplateOptions.DEPLOY_NOW deploys a version when it is uploaded.
Update metadata updateTemplate(idOrVersionId, CarboneTemplateUpdate) sends PATCH /template/:id.
List templates listTemplates(CarboneTemplateQuery) supports filters and cursor pagination. listTemplateCategories() and listTemplateTags() list categories and tags.
Render in one request renderAndDownload() calls ?download=true. renderInline() sends a base64 template with the request and does not store it.
Webhooks and headers CarboneRenderOptions takes webhookUrl, webhookHeader(...) and header(...).

Fix found while testing against the real API

The API silently ignores multipart text fields that have a Content-Type header. feign-form adds text/plain to every text field, so versioning, id, name and the other fields were dropped, and uploads came back with the legacy response. CarboneFormFieldWriter now writes these fields without the header.

Tests

  • CarboneV5Test: service logic, with Mockito.
  • CarboneHttpTest: checks the requests Feign actually sends, against a local HttpServer. It covers paths, headers, field order in the upload form (id before template), the absence of Content-Type on text fields, PATCH and download=true.
  • CarboneLiveTest: runs against the real API, and only when CARBONE_TOKEN is set (CARBONE_TOKEN=... mvn test -Dtest=CarboneLiveTest). It covers the full lifecycle: versioned upload, second version, PATCH, listing, all render methods including the existing render(path) on v5, and deletion. It passed against api.carbone.io (5.16.2) with a test key.

…-request render

Requests now use the Carbone API version 5 by default (pass "4" to create()
to keep the previous version), and the SDK version is bumped to 3.0.0.

New ICarboneServices methods, existing ones are unchanged:
- addTemplate(file, CarboneTemplateOptions): versioning, Template ID and
  metadata (name, comment, category, tags, sample, deployedAt, expireAt),
  returns a CarboneTemplate with the Template ID and Version ID.
- updateTemplate(): PATCH /template/:id.
- listTemplates() with filters and cursor pagination, listTemplateCategories(),
  listTemplateTags().
- renderAndDownload() (?download=true) and renderInline() (base64 template
  sent with the request, not stored).
- CarboneRenderOptions: webhook and custom headers on render requests.

The API ignores multipart text fields that have a Content-Type header, which
feign-form adds by default: CarboneFormFieldWriter sends them without one.

Tests: CarboneV5Test (service logic), CarboneHttpTest (requests built by Feign,
against a local server) and CarboneLiveTest (real API, only when CARBONE_TOKEN
is set).
@guillaume-carbone
guillaume-carbone merged commit a11d27f into master Oct 26, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant