Welcome to the BugFlows API guide! This page will walk you through the steps to train your machine learning model and get predictions using our powerful APIs. This is ideal for integrating BugFlows directly into your existing workflows and applications.

Prerequisites

Before you begin, please ensure you have the following:

  • Training Data CSVs: You'll need your bug data in CSV format. You can download a sample CSV to understand the structure.
    Download Sample CSV
  • Email ID: An email address that you have access to for OTP verification.
  • HTTP Testing Client: A tool like Postman, Hoppscotch (FOSS), or a command-line utility like cURL to make HTTP requests. This guide will describe *what* to do, not how to use a specific client.
  • Backend Server Address: https://prod-server-01.bugflows.com. All API calls will be made to this entry point.

How To: Step-by-Step API Guide

Follow these steps in order to complete the end-to-end workflow using the BugFlows API. If any step fails, please investigate the error response before proceeding, as subsequent steps depend on the success of previous ones.

For all APIs, a successful request will typically return an HTTP 200 OK status code. However, for some polling APIs (like status checks), a 200 OK might still indicate that a process is ongoing or has failed, so always check the response body.

Step 1: Check API Availability

This is a simple health check to ensure the backend server is reachable.

  • REST METHOD: GET
  • URI Path: /
  • Full Path: https://prod-server-01.bugflows.com/
  • Request Body: None
  • Expected Response: HTTP 200 OK. The body might be minimal or empty.

Example cURL:
curl -v https://prod-server-01.bugflows.com/
Step 2: Verify Email and Generate OTP

This API initiates the sign-in process by sending a One-Time Password (OTP) to the provided email address. The OTP is valid for 10 minutes.

  • REST METHOD: POST
  • URI Path: /verify_email_and_generate_otp
  • Full Path: https://prod-server-01.bugflows.com/verify_email_and_generate_otp
  • Request Body: JSON object with your email.
    {
        "email": "[email protected]"
    }

    Example cURL:
    curl -v --request POST --url https://prod-server-01.bugflows.com/verify_email_and_generate_otp \
    --header "Content-Type: application/json" \
    -d '{
      "email": "<your email address>"
    }'
  • Expected Response: HTTP 200 OK with a JSON body indicating the wait duration before another OTP can be requested.
    {
        "wait_duration_seconds": 60
    }
    Possible errors include 400 Bad Request for an invalid email format or 429 Too Many Requests if an OTP was generated recently.
Step 3: Sign In

Complete the sign-in process using your email and the OTP you received.

  • REST METHOD: POST
  • URI Path: /signin
  • Full Path: https://prod-server-01.bugflows.com/signin
  • Request Body: JSON object with your email and OTP.
    {
        "email": "[email protected]",
        "otp": "1234"
    }

    Example cURL:
    curl -v --request POST --url https://prod-server-01.bugflows.com/signin \
    --header "Content-Type: application/json" \
    -d '{
      "email": "<your email address>",
      "otp": "<the otp received in mail>"
    }'
  • Expected Response: HTTP 200 OK with a JSON body containing your unique session_id. This session_id must be used as a Bearer token in the Authorization header for subsequent authenticated API calls (e.g., Authorization: Bearer YOUR_SESSION_ID).
    {
        "session_id": "your_unique_session_id_here"
    }
    Possible errors include 401 Unauthorized for an invalid OTP or 410 Gone if the OTP has expired.
Step 4: Verify Session (Optional but Recommended)

You can use this endpoint to check if your current session_id is still valid and when it expires.

  • REST METHOD: POST
  • URI Path: /verify_session
  • Full Path: https://prod-server-01.bugflows.com/verify_session
  • Request Body: JSON object with your session_id.
    {
        "session_id": "your_unique_session_id_here"
    }

    Example cURL:
    curl -v --request POST --url https://prod-server-01.bugflows.com/verify_session \
    --header "Content-Type: application/json" \
    -d '{
      "session_id": "<your session ID received in previous step>"
    }'
  • Expected Response: HTTP 200 OK with a JSON body indicating validity and expiry.
    {
        "is_valid": true,
        "expires_at_in_seconds_since_epoch": 1678886400
    }
Step 5: Train Your Model

Upload your CSV file(s) to train the AI model. This is an authenticated endpoint, so include your session_id as a Bearer token in the Authorization header.

  • REST METHOD: POST
  • URI Path: /demo_train
  • Full Path: https://prod-server-01.bugflows.com/demo_train
  • Headers:
    • Authorization: Bearer <your session ID token> (Required)
    • is_anon: true/false (Required, boolean, indicates if model attributes should be anonymized)
  • Request Body: multipart/form-data containing your training CSV file.
    Below is an example cURL command. Ensure you replace placeholders like <your session ID token> and <path/to/your/training/csv> with actual values.
    curl -v --request POST --url https://prod-server-01.bugflows.com/demo_train \
    --header 'Authorization: Bearer <your session ID token>' \
    --header 'is_anon: false' \
    --form "file=@<path/to/your/training/csv>"
  • Expected Response: HTTP 200 OK with a JSON body containing the training_job_id.
    {
        "training_job_id": "your_training_job_id_here"
    }
    Possible errors include 400 Bad Request if the data is invalid or 401 Unauthorized if the session is invalid.
Step 6: Check Training Status

Periodically check the status of your training job using the training_job_id obtained in the previous step. This is an authenticated endpoint.

  • REST METHOD: POST
  • URI Path: /demo_status_training
  • Full Path: https://prod-server-01.bugflows.com/demo_status_training
  • Headers:
    • Authorization: Bearer <your session ID token> (Required)
    • Content-Type: application/json (Required)
  • Request Body: JSON object with the training_job_id.
    {
        "training_job_id": "your_training_job_id_here"
    }

    Example cURL:
    curl -v --request POST --url https://prod-server-01.bugflows.com/demo_status_training \
    --header 'Authorization: Bearer <your session ID token>' \
    --header 'Content-Type: application/json' \
    -d '{
      "training_job_id": "<your training job id received in previous step>"
    }'
  • Expected Response: HTTP 200 OK with a JSON body detailing the job status.
    {
        "training_job_id": "your_training_job_id_here",
        "result": {
            "status": "Processing",
            "status_description": "The training job is currently in progress."
        }
    }
    You need to poll this endpoint until the result.status is "Success". If it's "Failed", check the error object in the response for details. Do not proceed to prediction until training is successful.
    Example of a successful response:
    {
        "training_job_id": "your_training_job_id_here",
        "result": {
            "status": "Success",
            "status_description": "Training completed successfully."
        }
    }
Step 7: Get Predictions

Once your model training is successful, you can submit a bug summary (request string) to get predictions. This is an authenticated endpoint.

  • REST METHOD: POST
  • URI Path: /demo_predict
  • Full Path: https://prod-server-01.bugflows.com/demo_predict
  • Headers:
    • Authorization: Bearer <your session ID token> (Required)
    • Content-Type: application/json (Required)
  • Request Body: JSON object with the training_job_id (from a successfully trained model) and your request_string (e.g., a bug summary).
    {
        "training_job_id": "your_training_job_id_here",
        "request_string": "Login button not working on Safari browser after password reset."
    }

    Example cURL:
    curl -v --request POST --url https://prod-server-01.bugflows.com/demo_predict \
    --header 'Authorization: Bearer <your session ID token>' \
    --header 'Content-Type: application/json' \
    -d '{
      "training_job_id": "<your training job id that received status success>",
      "request_string": "Login button not working on Safari browser after password reset."
    }'
  • Expected Response: HTTP 200 OK with a JSON body containing the prediction_job_id.
    {
        "prediction_job_id": "your_prediction_job_id_here"
    }
Step 8: Check Prediction Status

Periodically check the status of your prediction job using the prediction_job_id. This is an authenticated endpoint.

  • REST METHOD: POST
  • URI Path: /demo_status_prediction
  • Full Path: https://prod-server-01.bugflows.com/demo_status_prediction
  • Headers:
    • Authorization: Bearer <your session ID token> (Required)
    • Content-Type: application/json (Required)
  • Request Body: JSON object with the prediction_job_id.
    {
        "prediction_job_id": "your_prediction_job_id_here"
    }

    Example cURL:
    curl -v --request POST --url https://prod-server-01.bugflows.com/demo_status_prediction \
    --header 'Authorization: Bearer <your session ID token>' \
    --header 'Content-Type: application/json' \
    -d '{
      "prediction_job_id": "<your prediction job id that you received in previous step>"
    }'
  • Expected Response: HTTP 200 OK with a JSON body detailing the job status and, upon success, the prediction results.
    {
        "prediction_job_id": "your_prediction_job_id_here",
        "is_anon": false,
        "result": {
            "status": "Processing",
            "status_description": "Prediction is in progress."
        }
    }
    Poll this endpoint until result.status is "Success". The predicted fields will then be available in the result_body.
    Example of a successful response with predictions:
    {
        "prediction_job_id": "your_prediction_job_id_here",
        "is_anon": false,
        "result": {
            "status": "Success",
            "status_description": "Prediction completed successfully."
        },
        "result_body": {
            "Priority": { "prediction": "P1", "confidence": 0.85 },
            "Assignee": { "prediction": "[email protected]", "confidence": 0.72 },
            "Resolution": { "prediction": "Fixed", "confidence": 0.90 }
    
        }
    }
    The actual fields in result_body will depend on your trained model.
  • Disclaimer:
    The accuracy of the model may be limited due to the small size (~10MB) of the training dataset. Smaller datasets can reduce prediction confidence. For better results, we recommend using your own data with a larger dataset (~100MB or more) to improve accuracy and reliability.

Further Technical Details

This guide provides an overview of the BugFlows API workflow. For a comprehensive technical specification of each API endpoint, including all possible request parameters, response codes, and detailed schema definitions, please refer to our OpenAPI specification file:
View api_spec.yaml

If you encounter any issues or have questions, please don't hesitate to reach out to our support team via the "Let's Talk!" link in the navigation or footer.