Atlassian uses cookies to improve your browsing experience, perform analytics and research, and conduct advertising. Accept all cookies to indicate that you agree to our use of cookies on your device.
Atlassian cookies and tracking notice, (opens new window)
Atlassian uses cookies to improve your browsing experience, perform analytics and research, and conduct advertising. Accept all cookies to indicate that you agree to our use of cookies on your device. Atlassian cookies and tracking notice, (opens new window)
Confluence

Knowledge Base
Results will update as you type.
  • Getting Started
  • Erasure Products
  • Erasure Software Tools
  • Asset Reimaging
  • Diagnostics Products
  • Management Portal
    • Management Portal - API
      • API Keys
      • Differences in Report Export API between Management Portal and Blancco Cloud
      • Example scripts for report exporting
      • Exporting reports using Management Portal API
      • Pagination and using cursor as part of Report Export API
    • Blancco Common License
    • Blancco Management Portal Upgrade Wizard
    • Blancco Management Portal Upgrade Wizard for Channel Partners
    • Configure single sign-on with Management Portal
    • Create a custom view to mimic the Management Console's "Summary reporting" feature
    • Feature comparison between Blancco Management Portal and Blancco Management Portal On-Premise
    • How to confirm your Blancco Management Portal erasure client endpoint details?
    • How to create custom views in Management Portal
    • How to recover your Blancco Management Portal account?
    • Transferring Reports from Blancco Cloud to Blancco Management Portal
    • Updating Erasure Client Communications Settings
    • "Upgrade successful" banner shown after logging in to Blancco Cloud
    • Blancco Licensing Bundles
    • How to add a company logo to the BMP and include it in the report template
    • Managing Licenses in License Pools
    • Export reports with custom name using custom fields
    • BMP User Invite Not Accepted Within 14 Days: Next Steps and Resolution Guide
    • How to gather SAML Tracer logs
    • Setting up User and Group Roles in the Blancco Management Portal.
    • Blancco Management Portal Account Disabled Due to Multiple Failed Login Attempts
    • Understanding the difference of user type and user role
    • Editing Custom Field Values for Reports in Blancco Management Portal
    • Instructions to verify the Blancco product hash value downloaded from the Blancco Management Portal
    • How to Change the Default View and Tenant Access View on the Blancco Management Portal
    • How to export and import custom views
    • Using “Match” and “Exist” operators
    • Using “Word starts with” and “Value starts with” operators
    • How to Create a Report Template on the BMP Portal
  • Management Portal (On-Premise)
  • Management Console
  • Hardware Products
  • Mobile Online Solutions (Inhance) Support
  • General Support Articles
  • License Activation
  • Professional Services
  • Key Deploy
  • Circulate

    You‘re viewing this with anonymous access, so some content might be blocked.
    /
    Example scripts for report exporting
    Updated Jul 25, 2023

      Example scripts for report exporting

      Jul 25, 2023

        Created date

        Updated date

        Affects version

        Fix version

        Jul 21, 2023 

        Jul 24, 2023 

        Management Portal

        N/A

        Description

        This page includes a collection of example scripts which can be used to get introduced with the Blancco Management Portal API endpoints.

        NOTE! The provided scripts are fully experimental and built a single use case scenario in mind and are not meant to be used in a production environment!

        There is no guarantee or warranty that these scripts will work as intended in a customer specific environment.

        Running this script is only recommended in a controlled, non-production environment. Use the provided scripts at your own risk.

        Python

        Requirements:

        • Python

        • Requests library

        This script will export multiple pages of reports one report at a time ("size" parameter set to 1) printing the results and giving a summary after exporting the last page/report.

        The endpoint URL, API key, export filter and other parameters are provided as part of the script and can be modified.

        Example python script to export multiple pages of reports a single report at a time
        import requests def execute_curl_request(cursor=None): url = 'https://api.eu-west-1.blancco.cloud/v1/report/export' headers = { 'Content-Type': 'application/json', 'X-BLANCCO-API-KEY': 'YOUR-API-KEY' } data = { "filter": { "date": { "gte": "2023-07-01T00:00:00Z" } }, "format": "XML", "container": "NONE", "size": 1 } if cursor: url += f"?cursor={cursor}" response = requests.post(url, headers=headers, json=data) return response def check_and_print_response(response): if response.status_code == 200: print(response.text) cursor_header = response.headers.get('x-blancco-cursor') return cursor_header, True else: print("Request failed with status code:", response.status_code) return None, False if __name__ == "__main__": cursor = None success_count = 0 failure_count = 0 while True: response = execute_curl_request(cursor) if success_count == 0: print("\n--------------------------------------------------") new_cursor, success = check_and_print_response(response) if success: success_count += 1 else: failure_count += 1 if new_cursor: cursor = new_cursor else: break print("\n--------------------------------------------------") print("All matching reports exported. Summary of exported reports:") print(f"Successful exports: {success_count}") print(f"Failed exports: {failure_count}")
          {"serverDuration": 28, "requestCorrelationId": "511d5b71d0ed445a86b1ccbf9ed152b6"}