JIRA expand = changelog无效

时间:2015-08-07 09:08:29

标签: api jira jira-rest-api

我正在尝试使用以下jql查询jira数据:

 $jql_options = array(
        "jql" => $jql,
        "startAt" => 0,
        "maxResults" => 1,
        "validateQuery" => false,
        "fields" => array(
            "summary",
            "status",
            "assignee"
        ),
        "expand" => "changelog"
    );

我得到了这个错误:

string(282) "{"errorMessages":["Can not deserialize instance of java.util.ArrayList out of VALUE_STRING token\n at [Source: org.apache.catalina.connector.CoyoteInputStream@464d8928; line: 1, column: 2] (through reference chain: com.atlassian.jira.rest.v2.search.SearchRequestBean[\"expand\"])"]}"

我理解“expand”=>这是一个错误“更改日志”,但在他们的网站上,他们提出了一个像我一样的请求代表。

你可以给我一些建议吗? :)

1 个答案:

答案 0 :(得分:0)

似乎我正在阅读其余的api文档错误。

“expand”选项仅在get请求中可用。

我在url +“& expand = changelog”中添加了jql数据,并在帖子中发送了其他选项!

    $jql_options = array(
        "startAt" => 0,
        "maxResults" => 1,
        "validateQuery" => false,
        "fields" => array(
            "key"
        )
    );

    $data = json_encode($jql_options);

    $options = array(
        CURLOPT_URL => $this->jiraURL . "/rest/api/latest/search?jql=" .urlencode($jql) . "&expand=changelog",
        CURLOPT_HTTPHEADER => array(
            'Authorization: Basic ' . base64_encode($this->username.":".$this->password),
            'Content-type: application/json') ,
        CURLOPT_RETURNTRANSFER => true,
        CURLOPT_POSTFIELDS => $data
    );