#!/bin/bash

input_file="lists_multi_report_1-N.json"
output_file="lists_multi_report_1-N_report.docx"
error_file="lists_multi_report_1-N_error.json"

response=$(curl --request POST --data-binary @"$input_file" http://localhost:8886/word_multi_report_1_N_json --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