2016-09-30 2 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

관련 문제