2016-09-28 81 views
3

我已經創建項目和回購我的gitlab.com帳戶,生成的私鑰,現在我試圖做api調用來獲取提交列表。無法找到基地GitLab API基地址

現在我想的通過API的項目列表,從文檔 https://docs.gitlab.com/ce/api/projects.html#list-projects

GET /projects 

所以我做

curl --header "PRIVATE-TOKEN: XXXXXXX -c" "https://gitlab.com/projects" 

並獲得404 我試過幾個組合無法找到正確的基本網址。

同爲存儲庫提交,文檔https://docs.gitlab.com/ce/api/commits.html

https://gitlab.example.com/api/v3/projects/5/repository/commits 

罰款,我想(與名爲myUsername /項目名稱爲項目ID) https://gitlab.com/api/v3/projects/myusername/projectname/repository/commits

,並獲得404以及

回答

2

的託管GitLab的正確基址是https://gitlab.com/api/v3/,所以您的請求
GET /projects將是

curl --header "PRIVATE-TOKEN: XXXXXX" "https://gitlab.com/api/v3/projects" 

此外,項目ID與項目名稱不同。您可以從您的請求的回覆中檢索項目編號GET /projects