Love Fuel?    Donate

FuelPHP Forums

Ask your question about FuelPHP in the appropriate forum, or help others by answering their questions.
post response is null in rest api
  • I want to use rest api in fuel. it is working get method. when i use post method, post data is giving null. please help me to overcome this issue.
  • That's not really anough information to give a meaningful answer. For Fuel, the method used to request a controller method isn't really relevant, all work exactly the same.
  • Here is my code:
    class Controller_Api extends Controller_Rest
    {
         protected $format = 'json';
         public function get_list()
        {
            return $this->response(array(
                'foo' => Input::get('foo'),
                'baz' => array(
                    1, 50, 219
                ),
                'empty' => null
            ));
        }
         public function post_register(){         
           return  $this->response(array(
                'email' => Input::post('email'),
                'password' => Input::post('password'),
                'baz' => array(
                    1, 50, 219
                ),
                'empty' => null
            ));
        }
    }

    the issue is when i run api/register?email=email&passowrd=password then result is null in Input::post(). I checked it with other rest tools, but result is null
  • Isn't that logical?

    api/register?email=email&passowrd=password

    is a GET-type request (with a query string), not POSTed data (in multipart/form-data).

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

In this Discussion