Reports

Duplicate a report for another client

Copies a report and points it at another client's data, in one call: the copy is made, it is rebound, a schedule is created when the body carries one, and it is added to a portal view when the body names one.

THE SHAPE OF THE BODY FOLLOWS THE SOURCE. A report that binds its data sources once for the whole report is rebound with data_sources; one that binds a connection per widget with connections. Sending the other one is refused by name, because a rebinding that did nothing would hand the new client a report reading the previous client's accounts. /v1/reports/get publishes report_level_data_sources for every report.

ONLY THE FIRST STEP CAN REFUSE THE CALL. Once the copy exists nothing undoes it, so the answer reports the other three as they went: bound[] and failed[] per binding, schedule and portal_view each saying whether it was requested and whether it was done, with the error_code of what stopped it. A retry with the same idempotency_key answers this same result and never writes a second report.

It asks for a confirmation when the body carries schedule or portal_view_key: those are the two steps that reach people. The creation of a schedule counts against the daily budget of calls that send email, and so does adding the report to a portal view when that notifies its users.

A report with cross-platform widgets that read an accounts group is refused with 400 INVALID_VALUE on report_key, naming those widgets: a copy for another client would keep showing the data of that group. Point them at the report connections in the editor first, or copy the report with /v1/reports/copy.

Refusals: 400 for the framework and the body, 400 INVALID_VALUE or MISSING_REQUIRED_FIELD when the rebinding does not match the source or the report has widgets on an accounts group, 403 WRITE_ACCESS_DISABLED, 403 PLAN_LIMIT_REACHED, 404 NOT_FOUND, 409 REPORT_IN_TRASH and 429 EMAIL_QUOTA_REACHED.

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

post/reports/duplicate-for-client

Request

  • Base URL: https://api.reportingninja.com/v1
  • URL: https://api.reportingninja.com/v1/reports/duplicate-for-client
  • Auth: HTTP bearer

Request body

report_keystring required

The report to duplicate. A template is refused: build a report from it instead.

namestring required

The title of the report, 1 to 60 characters: the name the cover paints. It is what /v1/reports/get answers as name.

internal_namestring

The name the list of the application shows, 1 to 100 characters. Left out, it is the title.

scheduleobject

A body of /v1/schedules/create without its report_key, which is the copy's. Sending it makes the call ask for a confirmation and spends one unit of the daily email budget.

portal_view_keystring

The portal view the copy is added to, from /v1/portal-views/list. There is no 'same as the original': the key is explicit. Sending it makes the call ask for a confirmation.

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.

confirmation_tokenstring

The token the first step of the call answered with. Send it back with the SAME body and the SAME idempotency_key to execute the call. It is good for one use and expires 600 seconds after it was issued.

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.