From 8d86b8b37db53152492e661915b86023e6e074f2 Mon Sep 17 00:00:00 2001
From: Xebax <xebax@wanadoo.fr>
Date: Fri, 17 Jun 2016 17:42:46 +0200
Subject: [PATCH] REST API: fix the definition of /orders/{id}/validate.

---
 htdocs/commande/class/api_orders.class.php | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)

diff --git a/htdocs/commande/class/api_orders.class.php b/htdocs/commande/class/api_orders.class.php
index fbbad50bd93..1f560775b7b 100644
--- a/htdocs/commande/class/api_orders.class.php
+++ b/htdocs/commande/class/api_orders.class.php
@@ -441,13 +441,17 @@ class Orders extends DolibarrApi
      * @param   int $id             Order ID
      * @param   int $idwarehouse    Warehouse ID
      * 
-     * @url GET     order/{id}/validate
-     * @url POST    order/{id}/validate
+     * @url POST    {id}/validate
      *  
      * @return  array
-     * TODO keep only one of the two verbs above (and fix the URL: {id}/validate)
+     * FIXME An error 403 is returned if the request has an empty body.
+     * Error message: "Forbidden: Content type `text/plain` is not supported."
+     * Workaround: send this in the body
+     * {
+     *   "idwarehouse": 0
+     * }
      */
-    function validOrder($id, $idwarehouse=0)
+    function validate($id, $idwarehouse=0)
     {
         if(! DolibarrApiAccess::$user->rights->commande->creer) {
 			throw new RestException(401);
-- 
GitLab