diff --git a/redfish-core/lib/log_services.hpp b/redfish-core/lib/log_services.hpp
index 149b9f6..9bf661a 100644
--- a/redfish-core/lib/log_services.hpp
+++ b/redfish-core/lib/log_services.hpp
@@ -1926,23 +1926,62 @@
                 const std::vector<std::string> &params) override
     {
         std::shared_ptr<AsyncResp> asyncResp = std::make_shared<AsyncResp>(res);
-        uint8_t clientAddress = 0;
-        uint8_t readLength = 0;
-        std::vector<uint8_t> peciCommand;
-        if (!json_util::readJson(req, res, "ClientAddress", clientAddress,
-                                 "ReadLength", readLength, "PECICommand",
-                                 peciCommand))
-        {
-            return;
-        }
+        std::vector<std::vector<uint8_t>> peciCommands;
 
+        nlohmann::json reqJson =
+            nlohmann::json::parse(req.body, nullptr, false);
+        if (reqJson.find("PECICommands") != reqJson.end())
+        {
+            if (!json_util::readJson(req, res, "PECICommands", peciCommands))
+            {
+                return;
+            }
+            uint32_t idx = 0;
+            for (auto const &cmd : peciCommands)
+            {
+                if (cmd.size() < 3)
+                {
+                    std::string s("[");
+                    for (auto const &val : cmd)
+                    {
+                        if (val != *cmd.begin())
+                        {
+                            s += ",";
+                        }
+                        s += std::to_string(val);
+                    }
+                    s += "]";
+                    messages::actionParameterValueFormatError(
+                        res, s, "PECICommands[" + std::to_string(idx) + "]",
+                        "SendRawPeci");
+                    return;
+                }
+                idx++;
+            }
+        }
+        else
+        {
+            /* This interface is deprecated */
+            uint8_t clientAddress = 0;
+            uint8_t readLength = 0;
+            std::vector<uint8_t> peciCommand;
+            if (!json_util::readJson(req, res, "ClientAddress", clientAddress,
+                                     "ReadLength", readLength, "PECICommand",
+                                     peciCommand))
+            {
+                return;
+            }
+            peciCommands.push_back({clientAddress, 0, readLength});
+            peciCommands[0].insert(peciCommands[0].end(), peciCommand.begin(),
+                                   peciCommand.end());
+        }
         // Callback to return the Raw PECI response
         auto sendRawPECICallback =
             [asyncResp](const boost::system::error_code ec,
-                        const std::vector<uint8_t> &resp) {
+                        const std::vector<std::vector<uint8_t>> &resp) {
                 if (ec)
                 {
-                    BMCWEB_LOG_DEBUG << "failed to send PECI command ec: "
+                    BMCWEB_LOG_DEBUG << "failed to process PECI commands ec: "
                                      << ec.message();
                     messages::internalError(asyncResp->res);
                     return;
@@ -1953,8 +1992,7 @@
         // Call the SendRawPECI command with the provided data
         crow::connections::systemBus->async_method_call(
             std::move(sendRawPECICallback), crashdumpObject, crashdumpPath,
-            crashdumpRawPECIInterface, "SendRawPeci", clientAddress, readLength,
-            peciCommand);
+            crashdumpRawPECIInterface, "SendRawPeci", peciCommands);
     }
 };
 
