2016-08-11 31 views
1

我在我的Codeigniter項目上安裝了RESTful Codeigniter API。當我測試API示例並通過http://textilexports.com/donate/api/example/users url通過Chrome郵遞員休息客戶端調用時,我在Post響應中遇到了該錯誤。發佈請求無法在Restful API Codeigniter上工作

{ 
    "id": 100 
    "name": null 
    "email": null 
    "message": "Added a resource" 
} 

public function users_post() 
{ 
    // $this->some_model->update_user(...); 
    $message = [ 
     'id' => 100, // Automatically generated by the model 
     'name' => $this->input->post('name'), 
     'email' => $this->input->post('email'), 
     'message' => 'Added a resource' 
    ]; 
    $this->set_response($message, REST_Controller::HTTP_CREATED); 
} 
+0

我有同樣的問題。你解決了這個問題嗎? –

回答

0

我在Firefox.Below利用休息的客戶看過你的REST API是當你傳遞的參數,如屏幕提到shot.Do在Chrome擴展相同的輸出。 enter image description here

+0

謝謝你的幫助。你能告訴我爲什麼它不適用於Chrome(高級休息客戶端)。謝謝http://img4.imagetitan.com/img.php?image=14_1786.png,http://img4.imagetitan.com/img.php?image=14_2343.png –

+1

你可以看到在那個圖像 –

+0

問題是你正嘗試通過頭信息發送POST參數。它錯了。所以你必須使用數據表單來發送POST參數。然後,一切正常。我已經通過Advanced Rest Client測試了它,它工作正常。 – Tharanga