Sections

Duplicate a section inside its report

Copies one section of a report, with every widget in it, INTO THE SAME REPORT, and raises the version of its sections structure.

IT IS NOT /v1/sections/copy WITH THE SAME REPORT TWICE, and that is why it is a route of its own. A copy that lands in ANOTHER report re-binds every widget to the connections of the target and drops the AI selections that named sections of the report it came from, because there those keys name nothing. Inside one report neither is right: the duplicate reads the same connections the original reads, and a summary in it that named a sibling section still has that sibling beside it. So nothing is re-bound and nothing is dropped -- which is exactly what the duplicate button of the section header does.

The copy lands at the END of the report, named after the original with the copy suffix of the account's language, trimmed to the 80 characters a section name takes: the suffix is kept whole and the title it came from is what gives way. The client briefs of its AI widgets travel with it.

It accepts if_version and compares it again inside the transaction that writes. A report built on a template is refused with 400 APPEND_NOT_ALLOWED, reason template_based: its sections belong to its template.

Refusals: 400 for the framework and the body, 400 APPEND_NOT_ALLOWED, 403 WRITE_ACCESS_DISABLED, 404 NOT_FOUND, 409 VERSION_MISMATCH and 409 REPORT_IN_TRASH.

Every write endpoint reads dry_run and idempotency_key; see the Write guarantees section of the introduction.

post/sections/duplicate

Request

  • Base URL: https://api.reportingninja.com/v1
  • URL: https://api.reportingninja.com/v1/sections/duplicate
  • Auth: HTTP bearer

Request body

report_keystring required

The report the section belongs to.

section_keystring required

The section to duplicate.

if_versioninteger

The sections version of the report, as /v1/reports/get publishes it. A stale one is HTTP 409 VERSION_MISMATCH.

dry_runboolean

Validate and answer what WOULD happen, without writing anything. Default false.

idempotency_keystring

Makes a retry safe: the answer of the first call is replayed for 24 hours to any later call with the same key and the same body.

Response

The call succeeded. This endpoint reports its errors with a real HTTP status, so a 200 always carries status=ok.

status'ok' required

Changes

No recorded changes to this operation across all 1 revision of this API.