Collectives™ on Stack Overflow
Find centralized, trusted content and collaborate around the technologies you use most.
Learn more about Collectives
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
Learn more about Teams
I'm trying to only get the commits of this day. I'm using CURL to make the request. I've tried ISO 8601 and RFC3339 but neither yield the result I'm looking for.
$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);
I've found out that in order for this to work, the since argument (and any other optional for that matter) needs to be in the url;
https://gitlab.example.com/api/v4/projects/ID/repository/commits?since=2018-09-03T00:00:00Z&until=2018-09-04T00:00:00Z
instead of in the headers like I have been doing.
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.