#!/bin/bash

input_file="add_rows_to_end.xml"
output_file="add_rows_to_end_report.xlsx"
error_file="add_rows_to_end_error.xml"

response=$(curl --request POST --data-binary @"$input_file" http://localhost:8886/excel_report_xml --output "$output_file" --write-out "%{http_code}")

if [ "$response" -ne 200 ]; then
  echo "Error while executing the request. Response code: $response"
  mv "$output_file" "$error_file"
else
  echo "The request was executed successfully. Response code: $response"
fi