ForSURE.reports.upload_reports

baseURL = 'finishedreports'

Base URL for all requests

POST {baseURL}/
async def upload_reports()

Upload completed reports in Excel or PDF format for automatic submission to PRO portals. The system uses stored client credentials to authenticate and submit reports automatically on behalf of clients.

Parameters
  • reports: List of file uploads containing reports from one or more sources (Excel or PDF format).
  • fileId: List of file IDs to keep track of the exact source of each report.
Returns

{
    "status_code": 200,
    "data": [
        {
            "reports": 2,
            "file_id": "file_id_123"
        }
    ]
}

Or if errors occur:

{
    "status_code": 400,
    "data": [
        {
            "file_id": "file_id",
            "error": "Error Message"
        }
    ]
}

GET {baseURL}/report_types
async def get_report_types()

Retrieve available report types organized by country and PRO, along with associated client credentials. This endpoint helps identify which clients have credentials configured for automatic report submission.

Returns

{
    "data": {
        "DE": {
            "WEEE": {
                "Stiftung EAR": {}
            }
        }
    },
    "clients": {
        "DE": {
            "WEEE": {
                "Stiftung EAR": ["Client 1", "Client 2"]
            }
        }
    }
}

POST {baseURL}/create/zero
async def create_report_zero()

Create and submit zero reports (reports indicating no data for a specific reporting period) to PRO portals. Zero reports are required when a client has no data to report for a given period.

Parameters
  • report_data: List of CreateReportData objects, each containing report_id, company, brand, country, report_type, pro, year, and timeframe.
Returns

{
    "status_code": 200,
    "data": []
}

Or if errors occur:

{
    "status_code": 400,
    "data": [
        {
            "report_id": "report_123",
            "error": "Error Message"
        }
    ]
}

GET {baseURL}/reportsDone
async def get_stat_reports()

Get the list of reports that were handed in.

GET {baseURL}/reportsDone/updates
async def get_update_reports()

Retrieve reports that have been updated or changed since a specified timestamp. This endpoint is useful for incremental updates to avoid re-fetching all reports.

Parameters
  • previous_time: Unix timestamp of the last update check. Only reports modified after this time will be returned.
Returns

{
    "data": [
        {
            "filename": "report_2024_Q1.xlsx",
            "status": "wait_confirmation",
            "updated_at": "2024-04-15T10:30:00Z"
        }
    ],
    "last_updated": 1713175800.0
}

POST {baseURL}/getdetails
async def get_details()

Retrieve detailed content of a report, submission, audit trail, or excluded data file. The response format depends on the file type and whether it should be displayed or downloaded.

Parameters
  • filepath: Name/path of the file to retrieve.
  • report_id: ID of the report, submission, audit trail, or excluded data entry.
  • filetype: Type of file - one of: "report", "submission", "audit_trail", or "excluded_data".
  • display: If True, return data as JSON for display. If False, return file for download (default: False).
Returns

If display=True, returns JSON:

{
    "Sheet1": [
        {
            "Type": "DE",
            "Amount Total": 5115,
            "Weight Total (kg)": 26.589,
            "Amount B2B": 3443,
            "Weight B2B (kg)": 17.944,
            "Amount B2C": 1672,
            "Weight B2C (kg)": 8.645,
            "Category": "Paper/Cardboard"
        }
    ]
}

If display=False, returns file download (Excel, PDF, PNG, etc.) with appropriate Content-Disposition header.

POST {baseURL}/getdetails/extracted
async def get_details_extracted()

Retrieve extracted data from a report in JSON format. This endpoint returns the raw extracted data before processing.

Parameters
  • report_id: ID of the report to retrieve extracted data for.
Returns

[
    {
        "Type": "DE",
        "Amount Total": 5115,
        "Weight Total (kg)": 26.589,
        "Amount B2B": 3443,
        "Weight B2B (kg)": 17.944,
        "Amount B2C": 1672,
        "Weight B2C (kg)": 8.645,
        "Category": "Paper/Cardboard"
    }
]

POST {baseURL}/multiple-reports
async def download_reports()

Download multiple reports as a ZIP archive. This endpoint allows bulk downloading of multiple reports, submissions, audit trails, or excluded data files.

Parameters
  • reportSelection: List of report selection dictionaries, each containing identifiers for the reports to download.
Returns

Returns a ZIP file download with Content-Type: application/zip and Content-Disposition: attachment; filename="reports.zip"

POST {baseURL}/delete-report
async def delete_report_endp()

Delete a report, submission, audit trail, or excluded data file. Reports that have already been submitted may not be deletable.

Parameters
  • file_name: Name/path of the file to delete.
  • filetype: Type of file being deleted (used for validation).
  • report_id: Optional ID of the report to delete. If provided, deletes from the report API. If not provided, deletes from local storage.
Returns

{
    "status_code": 200,
    "message": "Report deleted successfully.",
    "hide": true
}

Or if deletion fails (e.g., report already submitted):

{
    "status_code": 400,
    "message": "Failed to delete report, might be already submitted.",
    "hide": false
}