Reports

Change the settings of a report

Changes the fields of a report that already exists, the period of every one of its sections and the whole settings window of the report. It is a partial update: only the fields the body carries are written, and inside a block only the keys it carries, so everything it leaves out is left exactly as it is. /v1/reports/get publishes the same settings under settings, key by key, which is the object this call takes back.

date_range is not a field of the report: the period belongs to each SECTION, and what this field does is what the application's own button does, applying one range to ALL of them at once. It writes the range and nothing else, so the header of each section goes on showing whatever it showed. The answer lists the sections it wrote, and the cached results of the whole report are dropped so the next read is of the new period.

data_sources rebinds the report as a whole and is for the reports whose report_level_data_sources is true. On a report that binds a connection per widget it is refused with 400 APPEND_NOT_ALLOWED and reason per_widget_data_sources; those are rebound with /v1/reports/set-connections.

share is the public link of the report. The id is minted by the call the first time the report is shared and again whenever regenerate is true, which invalidates the previous link; a password is stored hashed and null empties it. A template has no public link and the field is refused on one.

The settings window is the rest of the body. brand_template and language_file take an empty string for the system one. A template carries no brand of its own: on one brand_template takes only the empty string, and the key a template still stores is accepted and changes nothing. front_cover carries the type, the texts and the date line, and the TYPE commands the file: a type that prints an uploaded PDF is refused on a report that carries none, and a type that prints none removes the file the report carried, which the answer says with a COVER_FILE_REMOVED warning -- a dry run says it too -- and before.front_cover.file. localization either follows the account or belongs to the report: the six settings under it exist only in the second case, sending one of them with use: account is refused, and a call that writes that branch asks for the six together. ai_brief has three states: absent keeps it, an empty string removes it, a text replaces it.

The block /v1/reports/get answers under settings is this body, whole: sending it back writes what the report already has and changes nothing. A key carrying null means the column has no value and is left as it is; an empty string is a value. The three keys only a read can answer -- brand_template_name, language_file_name and front_cover.file -- are accepted and ignored, each with a READ_ONLY_FIELD_IGNORED warning naming it. updated_fields and before carry the fields the call really wrote, so a block that changes nothing appears in neither.

Changing the language file, the localization mode or the date format drops the cached results of the report so the next read is of the new setting; nothing else drops them, and nothing is executed by this call.

The uploaded PDF of the cover is the one thing of that window this call does not write: it is a file, and it has a route of its own, /v1/reports/set-cover-file, which writes the cover type with it.

What it never writes: the level at which the report binds its data sources (moving a report to per widget bindings deletes its binding rows), its identity, structure and provenance, and the settings of the ACCOUNT.

There is no guard against concurrent edits: the call writes over whatever the report holds when it lands, a change made in the application since the client read the report included.

Refusals: 400 for the framework and the body, 400 APPEND_NOT_ALLOWED with reason per_widget_data_sources or template_based, 403 WRITE_ACCESS_DISABLED, 404 NOT_FOUND and 409 REPORT_IN_TRASH.

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

post/reports/update

Request

  • Base URL: https://api.reportingninja.com/v1
  • URL: https://api.reportingninja.com/v1/reports/update
  • Auth: HTTP bearer

Request body

report_keystring required

The report to change, from /v1/reports/list.

namestring

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, the one the report has is kept.

subtitlestring

The subtitle under the title. An empty string clears it.

internal_notesstring

Notes only the account sees. An empty string clears them.

brand_templatestring

The brand template the report is printed with: a key of a brand template of the account, or an empty string for the system one. A template carries no brand of its own and takes only the empty string, or the key it still stores, which changes nothing.

brand_template_namestring

Published by /v1/reports/get and written by nothing. It is accepted here so the whole settings block a read answers can be sent straight back as a body; the key is ignored and the answer carries a READ_ONLY_FIELD_IGNORED warning naming it.

language_filestring

The language file the report is printed with: an empty string for the system default, one of the sixteen system files (language_file_en, language_file_es, ...) or the key of a language file of the account.

language_file_namestring

Published by /v1/reports/get and written by nothing. It is accepted here so the whole settings block a read answers can be sent straight back as a body; the key is ignored and the answer carries a READ_ONLY_FIELD_IGNORED warning naming it.

substitution_variablesstring[]

The five substitution variables of the report, positional: the list carries exactly five values, one per %%CUSTOM_VAR_n%%, and an unused one is an empty string. Each of them is at most 800 characters.

snapshots_with_scheduled_executionsboolean

Whether a snapshot of the report is stored every time it is delivered by a schedule.

ai_briefstring nullable

What the AI summaries of this report should know about the client. Three states: leaving the field out -- or sending null, which is what a read answers for a report that has none -- keeps the brief the report has, an empty string removes it, and a text replaces it. At most 2000 characters. A brief that could not be written comes back as an AI_BRIEF_NOT_SAVED warning of a 200, with ai_brief left out of updated_fields.

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.