有谁知道如何通过Redmine Api Rest创建版本?

时间:2019-06-27 15:32:40

标签: ruby rest redmine redmine-api

我想通过redmine api rest为我的项目创建新版本。我将文档放在网络https://www.redmine.org/projects/redmine/wiki/Rest_Versions

url = Configuration.redmine+"/projects/#{project_id}/versions"
uri = URI.parse(url)
req = Net::HTTP::Post.new(uri.request_uri)
req.basic_auth(user, pass)
req["Content-Type"] = "application/json"

payload = {
    version: {
        name:version_name
    }
}
req.body = payload.to_json

http = Net::HTTP.new(uri.host, uri.port)
return = response = http.request(req)

实际结果是HTTPUnprocessableEntity(422),我希望创建201。响应正文如下所示:

<div id="content">
    <h2>422</h2>
</div>

应该是redmine api,当它给出这种类型的错误时,在响应主体中会出现错误的原因,但是在这里却什么也没显示

0 个答案:

没有答案