Reportnet API Python client: reference
Generated by
scripts/generate_docs.py(scripts/regen_docs.sh). Do not edit by hand; change the code,scripts/docs_caveats.pyor the generator and regenerate.
Look up any function to see its arguments, the ReportNet rights it needs and the caveats found
by live testing. Argument lists and roles come from the code and spec/api-docs.json; the
"Live-tested notes" come from a small hand-kept file (scripts/docs_caveats.py) that only repeats
facts recorded in docs/live_testing_notes.md.
ApiKey or Bearer?
ReportNet accepts two kinds of credential, and they are not interchangeable:
- ApiKey: a dataflow-scoped key issued to a reporting provider. It carries Reporter-level
access only and works only for its own dataflow (403 elsewhere). It cannot satisfy a rule that
needs a user-level dataflow role such as
DATAFLOW_CUSTODIANorDATAFLOW_STEWARD. - Bearer: the JWT of a logged-in user. It carries that user's actual roles on each dataflow.
A higher role is not always better: the ETL endpoints returned 403 for a Custodian/Steward Bearer
credential while an ApiKey worked (see the notes on those methods). A dead or revoked ApiKey shows
up as a 500 "401 UNAUTHORIZED" on any call; list_datasets is a quick way to check.
"Allowed roles" tables are what the API spec declares per dataset type; for methods whose spec
states none (including hand-written ones) the page says "Not stated in the API spec". The
/private/* operations in the spec are not on this client (they are unreachable through the
gateway), see removed private endpoints.
Every resource method also exists on AsyncReportnetClient, called with await.
Pages
Dataflow (hand-written)
create_dataflow: create a dataflow and return its new id.dataflow_datasets: the dataflow with its datasets (designDatasets,reportingDatasets,dataCollections,euDatasets, `re...dataflows: dataflows visible to the logged user.delete_dataflow: delete a dataflow with its design datasets, documents and representatives.
Dataset Schema
export_dataflow_schemas_zip: Downloads the full dataflow schema export ZIP: one.schema/.qcrules/.unique/.integrity/`.extintegr...export_field_schemas: Allowed roles: CUSTODIAN, STEWARD, EDITOR WRITEexport_field_schemas_from_dataset: Allowed roles: CUSTODIAN, STEWARD, EDITOR WRITEfind_data_schema_by_dataset_id: Get dataset schema by dataset idget_simple_schema: Get dataset schema by dataset idget_table_schemas_ids: Get list of dataset table schemas by dataset idimport_dataflow_schemas_zip: add the dataset schemas of an export ZIP (export_dataflow_schemas_zip()'s file set) to a dataflow.import_dataflow_schemas_zip_and_wait: Import a schema ZIP into a dataflow and wait until it looks done.import_field_schemas: Allowed roles: CUSTODIAN, STEWARD, EDITOR WRITEupdate_manually_editable_by_dataset_id: updateManuallyEditableByDatasetId
Datasets
check_import_process: Test import file to dataset data (Large files)convert_iceberg_to_parquet_tables: convertIcebergToParquetTablesconvert_parquet_to_iceberg_tables: convertParquetToIcebergTablescreate_empty_tables_v3: createEmptyTablesV3create_public_files: createPublicFilesdelete_attachment: Delete attachment by field iddelete_dataset_data: Delete dataset datadelete_import_table: Deletes all data in one table. Hidden legacy (unversioned) alias ofdelete_table_data()(`/dataset/v1/{id...delete_table_data: Delete table datadownload_imported_file: Downloads a specific imported file for a given dataset and a given filenameduplicate_field_value_exists: duplicateFieldValueExistsetl_export_dataset: Export data by dataset idetl_export_dataset_v2: Export data by dataset idetl_export_dataset_with_job: Export data by dataset idetl_export_zip_csv: Export data by dataset idetl_export_zip_parquet: Export parquet data by dataset idetl_import_dataset: Import data by dataset idetl_import_dataset_dl: etlImportDatasetDLexport_dataset_to_file: Export the whole dataset todest, waiting for the file.export_dataset_with_job_to_file: Export a dataset (v3 job variant) intodest, waiting for the job.export_table_to_file: Export one table todest, waiting for the file: start the export, then poll the download.export_zip_csv_to_file: Export a dataset as a ZIP of CSV files intodest, waiting for the job.export_zip_parquet_to_file: Export a dataset as a ZIP of Parquet files intodest, waiting for the job.fetch_export_file: (ordownloadFileDL): download a generated export file.generate_import_presigned_url: generateImportPresignedUrlget_attachment: Download attachment by field idget_available_for_manual_editing_tables: getAvailableForManualEditingTablesget_iceberg_tables: getIcebergTablesget_import_related_statistics: getImportRelatedStatisticsget_record_geometry: getRecordGeometryget_released_dataset_data_info: getReleasedDatasetDataInfoimport_big_file_data: Import file to dataset data (Large files)import_file_and_wait: Upload a file into a dataset and wait until the import is visible.import_file_data: Import file to dataset data (Large files not allowed > 50 MB)is_iceberg_table_created: isIcebergTableCreatedlist_imported_files: Returns all imported files for a given datasetrestore_prefilled_tables: restorePrefilledTablesstart_dataset_export: (orexportDatasetFileDL): start exporting the whole dataset.start_table_export: (orexportFileDLwithbig_data=True): start exporting one table.update_attachment: Update attachment by field idupdate_dataset_name: rename a dataset (as the web app renames a design dataset, i.e. its schema).update_geometry: updateGeometryupdate_geometry_v2: updateGeometryV2wait_for_job: Wait for an async job to finish and return its last status answer.
Dataset Snapshot
delete_snapshot: Delete dataset snapshot by snapshot iddownload_historic_releases_csv: downloadHistoricReleasesCSVexport_historic_releases_csv: exportHistoricReleasesCSVhistoric_releases: Get dataset historic releases by dataset id
EU Datasets
populate_data_from_data_collection: Allowed roles: CUSTODIAN, STEWARD
Release receipts
create_release_receipt: createReleaseReceiptdelete_release_receipt_by_dataflow_id: deleteReleaseReceiptByDataflowIdget_release_receipt_by_dataflow_id: getReleaseReceiptByDataflowIdupdate_release_receipt: updateReleaseReceipt
Reference dataset (hand-written)
set_updatable: Lock or unlock a reference dataset (PUT /referenceDataset/{datasetId}).
Representative (hand-written)
create_lead_reporter: add a lead reporter.create_representative: add a representative (data provider) to a dataflow.data_provider: one provider (same fields asdata_providers()items). Any authenticated user.data_provider_groups: the country provider groups.data_providers: the providers in a group.export_lead_reporters_file: the web app's "Export lead reporters" CSV.import_lead_reporters_file: add lead reporters from a CSV.representatives: a dataflow's representatives.validate_lead_reporters: recheck lead reporters.
User (hand-written)
refresh_token: renew a web-app login.
Validation (hand-written)
download_validations_file: fetch the generated CSV todest.export_validations_to_file: Generate the validations CSV and wait for it, saving it atdest.list_group_validations: failed validations grouped by rule (what the UI shows).list_group_validations_dl: grouped failures, data-lake datasets.list_validations: failed validations, one per failure.start_validation: queue a validation.start_validations_export: generate the validations CSV.
Notebook helpers (reportnet_api.easy)
apply_schema_dtypes: Convert columns to the types the dataset schema declares.check_access: Read-only self-check of a credential: which kind, alive, dataflow reachable.check_import_file: Read-only pre-check of an import file; returns the problems found (empty = ok).connect: Build a client from arguments or environment variables.connect_interactive: Likeconnect(), but asks for the credential with a hidden prompt.demo_client: A client that answers from built-in fictional data: no network, no credential.export_table: Export one table (by name) todestas csv/xlsx/..., waiting for the file.export_to_file: Export a dataset as a ZIP of CSV (or Parquet) files atdest.export_validations: Save a dataset's validation failures as a CSV atdestand return the path.find_dataflow: One dataflow handle by id or name text (seehandles.find_dataflow).guide: Print a one-page cheat sheet of the helpers in the order a notebook uses them.import_dataframe: Import a DataFrame into one table of a dataset (import_fileunderneath). WRITES.import_file: Upload a CSV (or other import file) into a dataset and wait until it is in.is_data_lake: True when the dataflow is a data-lake one (bigData: truein its dataset listing).list_dataflows: All dataflows visible to the credential, one row each (id, name, status, ...).list_datasets: Datasets of a dataflow as a flat table: dataset_id, name, kind, provider_id.list_providers: Data providers of a group as a table: provider_id, code, label, group_id.list_tables: Tables defined in a dataset's schema: table_id and name.read_all_records: Every table as{table name: list of row dicts}, without pandas (seeread_records).read_many: One table from several dataset handles, stacked (seehandles.read_many).read_records: One table as a list of dicts, without pandas (for FME and plain scripts).read_table: One table of a dataset as a DataFrame.read_tables: Download a dataset's data as{table_name: DataFrame}.validate_and_wait: Start a validation, wait until it finishes, returnvalidation_errors().validation_errors: Failed validations of a dataset, one row per failing rule (what the UI shows).validation_summary: Failures counted per table and level: table, level, rules, records.
Job polling (reportnet_api.jobs)
async_wait_for_job: Async twin ofwait_for_job().download_url_of: ThedownloadUrlof a finished export job.import_statistics_changed: True ifget_import_related_statistics()shows a new import sincebefore.job_id_of: The job id of a job-start answer: itsjobId, else parsed from thepollingUrl.polling_url_of: ThepollingUrlof a job-start answer (or the string itself).progress_event: The dict a progress callback receives.progress_scope: Resolve aprogressargument to a callback (or None) for the duration of a wait.wait_for_job: Poll a job'spollingUrluntil FINISHED and return the last answer.
Handles (reportnet_api.handles)
Dataflow.dataset: One dataset by id, country code or name; exactly one match orLookupError.Dataflow.datasets: The dataflow's datasets as a DataFrame (easy.list_datasets).Dataflow.refresh: A new handle read afresh from the server; this one is left unchanged.Dataset.export: Export the dataset as a ZIP of CSV or Parquet files atdest(easy.export_to_file).Dataset.export_validations: Save the validation failures as a CSV atdest(easy.export_validations).Dataset.read: One table as a DataFrame (easy.read_table).Dataset.read_all: All tables as{table_name: DataFrame}(easy.read_tables).Dataset.tables: The dataset's tables as a DataFrame (easy.list_tables).Dataset.upload: Import a file into the dataset and wait for it (easy.import_file). WRITES.Dataset.validate: Start a validation, wait for it, return the failures (easy.validate_and_wait). WRITES.Dataset.validation_errors: Failed validations, one row per failing rule (easy.validation_errors).Dataset.validation_summary: Failures counted per table and level (easy.validation_summary).