我试图只获得今天的提交。我正在使用CURL来发出请求。我已经尝试过ISO 8601和RFC3339,但都没有产生我正在寻找的结果。
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => "https://gitlab.example.com/api/v4/projects/ID/repository/commits",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => array(
"Private-Token: PRIVATE-TOKEN",
"since: 2018-09-03T00:00:00Z",
"until: 2018-09-04T00:00:00Z"
),
));
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
$commits = $response;
print_r($commits);
我发现为了使它能够工作,自那个论证(以及任何其他可选的)需要在url中;
https://gitlab.example.com/api/v4/projects/ID/repository/commits?since=2018-09-03T00:00:00Z&until=2018-09-04T00:00:00Z
而不是像我一直在做的标题。