jonathandey / oc-jd-dingoapi

Dingo/API implementation for OctoberCMS
MIT License
16 stars 7 forks source link

How do I get parameters from the request? #4

Closed chrisiek closed 7 years ago

chrisiek commented 7 years ago

According to documentation this should work.

$api->version('v1', ['prefix' => 'api'], function ($api) {
  $api->get('go/{id}', function ($api) {
    trace_log(Input::get('id'));
    return ['now' => microtime()];
  });
});

but I get nothing in the log.

I call this API from browser http://developer.dev/api/go/234 I get absolutely nothing in my log file. Without 234 octobercms returns 404, so it partly works.

chrisiek commented 7 years ago

I have found the solution.

$api->version('v1', ['prefix' => 'api'], function ($api) {
  $api->get('go/{id}', function ($id) {
    trace_log($id);
    return ['now' => microtime()];
  });
});