我正在使用名为"ActiveCollab"的API,我正在尝试构建一个自定义报告。
API::get('/users/3/time-records/filtered-by-date')
Query Parameters:
{
"from": "2014-12-01",
"to": "2014-12-31"
}
我不知道该怎么做。。。
我试过API::get('/users/3/time-records/'.$filtered-by-date)
$filter-by-date = {
"from": "2014-12-01",
"to": "2014-12-31"
}
and
$filter-by-date = json_encode({
"from": "2014-12-01",
"to": "2014-12-31"
});
它根本不起作用。。我一定是按日期过滤错了,但是我不知道该怎么办。
感谢
编辑:
也试过这个
$filter_by_date = json_encode(["from"=>"2014-12-01","to"=> "2014-12-31"]);
API::get('/users/'.$request->get('employee').'/time-records/filter_by_date')
还是没什么。。
我的文章的顶部是API文档如何显示它,我只是不知道如何执行。。。
这是OP在编辑问题时给出的答案
如果其他人正在使用ActiveCollabneneneba API,下面是如何传递变量。
API::get('/users/'.$userID.'/time-records/'. http_build_query(['from' => $this->from, 'to' => $this->to]);