2017-02-18 87 views
1

我試圖通過geoserver rest api使用put方法更新工作區名稱。Geoserver Rest API更新工作區名稱

我得到「無法更改工作區的名稱。」錯誤。

這是我的代碼。

$service = geoserver_url; 
$data = "<workspace><name>testnew</name></workspace>"; 
     $url = $service . "rest/workspaces/workspacename"; 
     $ch = curl_init($url); 
     curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); 
     $passwordStr = username:password 
     curl_setopt($ch, CURLOPT_USERPWD, $passwordStr); 
     curl_setopt($ch, CURLOPT_HTTPHEADER, array("Content-type: application/xml");); 
      curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'PUT'); 
      curl_setopt($ch, CURLOPT_POSTFIELDS, $data); 
     $result = curl_exec($ch); 

     $info = curl_getinfo($ch); 

    Any kind of help appreciated. 

回答

1

這不是一個允許的操作(如在manual中所述)。任何改變工作空間名稱的PUT都會返回403錯誤。

您所能做的就是創建一個新的工作區,複製舊工作區的內容,然後將其刪除。