This page outlines a structured process for generating a Worth 360 Report using Worth AI’s APIs and tools. The flow supports two main steps, offering flexibility in how reports are generated and tracked starting with initiating the report and followed by retrieving its status and result.


Process breakdown

1. Initiate Report Generation

  • Trigger Report Creation:
    The Customer makes a request to generate a Worth 360 Report using the following API:

    API Endpoint: POST /reports/customers/:customerID/businesses/:businessID

    Expected Response:

    {
        "status": "success",
        "message": "Report generation started successfully",
        "data": {
            "report_id": "reportID"
        }
    }
    

2. Track Report Status & Download

  • Poll Report Status: Use the report ID received from the previous step to check the report status:

    API Endpoint: POST /reports/:reportID/download

  • Possible Status Responses:

    StatusMeaning
    REQUESTEDReport request is initiated
    IN_PROGRESSReport is currently being generated
    COMPLETEDReport is ready and log contains the final JSON output
    FAILEDReport generation failed and log contains error reasons

3. Output Responses

  • If COMPLETED, the response will include the generated JSON data:

    {
      "status": "success",
      "message": "Report downloaded successfully",
      "data": {
        "id": "reportID",
        "report_type_id": 1,
        "status": "COMPLETED",
        "log": {
          // Worth 360 report JSON
        },
        "created_at": "2025-04-10T11:01:43.228Z",
        "created_by": "adminID",
        "updated_at": "2025-04-10T11:01:58.259Z",
        "triggered_by": "CUSTOMER",
        "triggered_id": "customerID",
        "file_path": "filePath",
        "report_type": {
          "core_report_types": {
            "id": 1,
            "code": "business_report",
            "label": "Business Report"
            }
        },
        "pdf_url": "pdfURL"
      }
    }
    
  • If FAILED, the response will include failure reasons:

    {
      "status": "success",
      "message": "Report is not ready to download",
      "data": {
        "id": "reportID",
        "report_type_id": 1,
        "status": "FAILED",
        "log": {
          // Failure reasons
        },
        "created_at": "2025-04-10T11:01:43.228Z",
        "created_by": "adminID",
        "updated_at": "2025-04-10T11:01:58.259Z",
        "triggered_by": "CUSTOMER",
        "triggered_id": "customerID",
        "file_path": "filePath",
        "report_type": {
          "core_report_types": {
            "id": 1,
            "code": "business_report",
            "label": "Business Report"
            }
        },
        "pdf_url": null
      }
    }
    

Other APIs

1. Check Worth 360 Report with businessID

The Customer makes a request to check a Worth 360 Report generation status with businessID using the following API:

API Endpoint: GET /reports/businesses/:businessID/status

Expected Response:

{
  "status": "success",
  "message": "Report status fetched successfully",
  "data": {
    "report_details": {
      "id": "reportID",
      "report_type_id": 1,
      "log": {
        // Worth 360 report JSON
      },
      "created_at": "2025-04-10T10:49:15.225Z",
      "created_by": "adminID",
      "updated_at": "2025-04-10T10:49:30.328Z",
      "triggered_by": "ADMIN",
      "triggered_id": "adminID",
      "status": "COMPLETED"
    },
    "status": "COMPLETED"
  }
}

2. Fetch Worth 360 Report Details (JSON without pdfURL)

The Customer makes a request to fetch a Worth 360 Report details using the following API:

API Endpoint: GET /reports/customers/:customerID/businesses/:businessID

Expected Response:

{
  "status": "success",
  "message": "Report downloaded successfully",
  "data": {
    "id": "reportID",
    "report_type_id": 1,
    "status": "COMPLETED",
    "log": {
      // Worth 360 report JSON
    },
    "created_at": "2025-04-10T11:01:43.228Z",
    "created_by": "adminID",
    "updated_at": "2025-04-10T11:01:58.259Z",
    "triggered_by": "CUSTOMER",
    "triggered_id": "customerID",
    "file_path": "filePath",
    "report_type": {
      "core_report_types": {
        "id": 1,
        "code": "business_report",
        "label": "Business Report"
        }
    }
  }
}