gpt4 book ai didi

json - 吉拉 API |错误 : "Operation value must be a string" - trying to set value nested two levels deep

转载 作者:行者123 更新时间:2023-12-04 12:45:38 28 4
gpt4 key购买 nike

尝试创建特定requestType 的新 jira 票证,但它嵌套了两层。尝试了一些可能的改变,但没有运气。这是我的代码,

require 'jira-ruby' # https://github.com/sumoheavy/jira-ruby

options = {
:username => jira_username,
:password => jira_password,
:site => 'https://jiraurl/rest/api/2/',
:context_path => '',
:auth_type => :basic,
:read_timeout => 120
}

client = JIRA::Client.new(options)
issue = client.Issue.build
fields_options = {
"fields" =>
{
"summary" => "Test ticket creation",
"description" => "Ticket created from Ruby",
"project" => {"key" => "AwesomeProject"},
"issuetype" => {"name" => "Task"},
"priority" => {"name" => "P1"},
"customfield_23070" =>
{
"requestType" => {
"name" => "Awesome Request Type"
}
}
}
}
issue.save(fields_options)

"errors"=>{"customfield_23070"=>"操作值必须是字符串"}

还尝试将 JSON 对象传递给 customfield_23070"customfield_23070": { "requestType": { "name": "Awesome Request Type"} } 仍然没有运气,得到同样的错误信息。

如果有帮助,这就是 customfield_23070 在我们的 Jira 中的样子, enter image description here

有人知道在这种情况下如何设置requestType吗?非常感谢任何帮助!!

最佳答案

似乎对于具有特定数据类型(字符串/数字)的自定义字段,您必须将值传递为:

"customfield_1111": 1

或:

"customfield_1111": "string"

代替:

"customfield_1111":{ "value": 1 }

或:

"customfield_1111":{ "value": "string" }

关于json - 吉拉 API |错误 : "Operation value must be a string" - trying to set value nested two levels deep,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/49764843/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com