简体   繁体   English

Gitlab API curl 请求

[英]Gitlab API curl request

When I'm trying to use GitLab API GET request to get all commits from specific date range and specific branch, I receive only commits from NEXT day after I put since date.当我尝试使用 GitLab API GET 请求获取特定日期范围和特定分支的所有提交时,我只收到自日期后的第二天的提交。

I mean, if I define since date for example - from 2022-12-01T12:17:30.000+02:00 until 2022-12-15T15:01:36.000+01:00 .我的意思是,如果我定义自日期,例如 - 从2022-12-01T12:17:30.000+02:002022-12-15T15:01:36.000+01:00 But, my commits from curl request starting from 2 Dec 2022.但是,我从 2022 年 12 月 2 日开始的 curl 请求提交。

How does to include initial date to response?如何将初始日期包含在响应中?

curl -s --header "PRIVATE-TOKEN: <token>" https://gitlab.example.com/api/v4/projects/ID/repository/commits"?ref_name=${branch}&since=${since_date}&until=${until_date}" | jq -r '.[] | .committed_date + "\t" + .title'

Response which I receive:我收到的回复:

2022-12-15T15:01:36.000+01:00
2022-12-15T14:39:44.000+02:00
2022-12-14T08:26:43.000+02:00
2022-12-13T20:55:03.000+02:00
2022-12-13T15:51:34.000+01:00
2022-12-13T15:43:26.000+01:00
2022-12-12T16:50:49.000+01:00
2022-12-07T16:38:26.000+01:00
2022-12-05T22:41:04.000+01:00
2022-12-02T09:23:58.000+01:00

By the way, I tried to use, but it didn't help me.顺便说一句,我尝试使用,但它对我没有帮助。

?first_parent=true

It could be a pagination problem.这可能是一个分页问题。 Try adding &per_page=100 to see if there are more commits.尝试添加&per_page=100以查看是否有更多提交。 I think you can't get more than 100 items in one api call.我认为您不能在一个 api 电话中获得超过 100 件物品。

See https://docs.gitlab.com/ee/api/#pagination for more info有关详细信息,请参阅https://docs.gitlab.com/ee/api/#pagination

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM