-1

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);

1 Answers1

0

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.