通过Rest API创建Stash回购?

问题描述:

编辑2: 我知道它使用wget工作。这里是wget命令:通过Rest API创建Stash回购?

wget --no-check-certificate --header='Host: [hostname]' --header 'Connection: keep-alive' --header 'Authorization: Basic [user:pass(Base64)]' --header 'Content-Type: application/json' --header 'Accept: application/json' --post-data='{"slug":"test", "name":"test"}' https://[hostname]/rest/api/1.0/projects/[projectName]/repos/ 

根据文档,它可能是这样的。尽管如此,我似乎无法让它工作。有没有人设法使这项工作?

编辑1:

我实际上设法通过手动创建通过代理的HTTP请求来创建回购。这是请求的工作:

POST /rest/api/1.0/projects/[Project Name]/repos HTTP/1.1 
Host: [hostname] 
Connection: keep-alive 
Authorization: Basic [user:pass (Base64)] 
Content-Length: 29 
Cache-Control: max-age=0 
Origin: https://[hostname] 
User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.1 (KHTML, like Gecko) Chrome/21.0.1180.83 Safari/537.1 
Content-Type: application/json 
Accept: application/json 
Accept-Encoding: gzip,deflate,sdch 
Accept-Language: en-US,en;q=0.8 
Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.3 

{"slug":"test","name":"test"} 

但是,当我试图模仿这使用卷曲我无法得到它的工作。这里是卷曲的请求:

curl -k -X POST -H "Host: [hostname]" -H "Connection: keep-alive" -H "Authorization: [user:pass (Base64)]" -H "Content-Length: 29" -H "Cache-Control: max-age=0" -H "Origin: https://[hostname]" -H "User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.1 (KHTML, like Gecko) Chrome/21.0.1180.83 Safari/537.1" -H "Content-Type: application/json" -H "Accept: application/json" -H "Accept-Encoding: gzip,deflate,sdch" -H "Accept-Language: en-US,en;q=0.8" -H "Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.3" --data {"slug":"test", "name":"test"} https://[hostname]/rest/api/1.0/projects/[projectName]/repos/ 

我不能告诉藏匿期待的是没有被卷曲在第二请求中提供。有任何想法吗?

+0

你能更具体地说明什么不起作用吗?如果有的话可能是错误信息? – R0MANARMY

+0

@nweiler你应该发布你的编辑1 /编辑2作为你自己问题的答案。 – mike

+0

@mike好点。完成。 – nweiler

我知道它使用wget工作。这里是wget命令:

wget \ --no-check-certificate \ --header='Host: [hostname]'\ --header 'Connection: keep-alive' \ --header 'Authorization: Basic [user:pass(Base64)]' \ --header 'Content-Type: application/json' \ --header 'Accept: application/json' \ --post-data='{"slug":"test", "name":"test"}' \ https://[hostname]/rest/api/1.0/projects/[projectName]/repos/