2016-09-30 28 views
1

jiraには「Abc Def Management」というプロジェクトがあります。私はこのプロジェクト内のすべての問題を取得しようとしたときに残りのAPIを使用して、私は次のエラーが発生しています。JQLクエリのエラー: '%'は予約済みのJQL文字です

errorMessages: [ 'Error in the JQL Query: The character \'%\' is a reserved JQL character. You must enclose it in a string or use the escape \'\\u0025\' instead. 

私は以下のコードを入力しています。

client.post("https://xxx.atlassian.net/rest/auth/1/session", loginArgs, function(data, response){ 
     console.log('Response', response); 
     if (response.statusCode == 200) { 
      console.log('succesfully logged in, session:', data.session); 
      var session = data.session; 
      // Get the session information and store it in a cookie in the header 
      var searchArgs = { 
       headers: { 
        // Set the cookie from the session information 
        cookie: session.name + '=' + session.value, 
        "Content-Type": "application/json" 
       }, 
       data: { 
        // Provide additional data for the JIRA search. You can modify the JQL to search for whatever you want. 
        jql: "project=Abc%20Def%20Management" 
       } 
      }; 
      // Make the request return the search results, passing the header information including the cookie. 
      client.post("https://xxx.atlassian.net/rest/api/2/search", searchArgs, function(searchResult, response) { 
       console.log('status code:', response.statusCode); 
       console.log('search result:', searchResult); 
      }); 
      // response.render('index', { 
      // }); 
     } 
     else { 
      console.log("Login failed"); 
      // throw "Login failed :("; 
     } 
    }); 

どうすればこのエラーを解決できますか?

答えて

1

%20の代わりにスペースを使用してください。

URLの一部ではなく、本文にjqlを持つPOSTリクエストを使用しています。したがって、URLをエンコードする必要はありません。

+0

私もこれを試しましたが、動作しません。プロジェクトの名前が 'abc'のような単一の単語である場合、結果も生成されません。 –

+0

jiraの問題検索で試してみると、jqlは結果を返しますか? – GlennV

+1

@Appunniプロジェクト名を引用符で囲む必要があります。 'jql =" Project = "" Abc Def Management \ "" ' – rorschach

関連する問題