2016-08-11 6 views
1

私はCodeigniterプロジェクトにRESTful Codeigniter APIをインストールしました。私はAPIの例を試して、http://textilexports.com/donate/api/example/users URLでChromeのPostman Rest Clientを呼び出して、Postのレスポンスでそのエラーが発生しました。投稿リクエストがうまく機能しない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をチェックしました画面で説明したように、あなたがChromeの拡張機能でも同じshot.Doパラメータを渡されたときに出力されます。 enter image description here

+0

ありがとうございます。 Chrome(Advance Rest Client)で動作しない理由を教えてください。ありがとうhttp://img4.imagetitan.com/img.php?image=14_1786.png、http://img4.imagetitan.com/img.php?image=14_2343.png –

+1

その画像で見ることができます –

+0

問題はあなたは、ヘッダー情報を介してPOSTパラメータを送信しようとしています。間違っています.Postパラメータを送信するためにデータフォームを使用する必要があります。すべてのok.iは、Advanced Rest Client経由でテストしました。 – Tharanga

関連する問題