我需要定期從 api 檢索特定分支上的所有提交。我想從記錄的最近一次提交開始,但因為某個日期也可以。
我擁有的是
curl https://github.mycompany.com/api/v3/repos/&owner/&repo/commits?sha=branchname
這似乎讓我得到了正確的提交,但我很好奇為什么我不能附加 &since=datetime 例如
curl https://github.mycompany.com/api/v3/repos/&owner/&repo/commits?sha=branchname&since=2021-10-19T00:00:00Z
我有一種感覺,我缺少一些簡單的語法,但任何幫助將不勝感激。
uj5u.com熱心網友回復:
curl從 shell呼叫時,需要在 URL 周圍加上引號。這是因為 shell 認為&它是特殊的(它導致行程在后臺運行),因此需要參考以便將&符號視為 URL 的一部分。
例如:
$ curl 'https://github.mycompany.com/api/v3/repos/git/git/commits?sha=branchname&since=2021-10-19T00:00:00Z'
轉載請註明出處,本文鏈接:https://www.uj5u.com/ruanti/332921.html
標籤:github github-api
