Parsing jql rest api

const validateJQLQueries = async (queries) => {
// Assuming queries is a single string and not an array of multiple queries
const bodyData = JSON.stringify({
queries: [queries]
});

const response = await api.asUser().requestJira(route`/rest/api/3/jql/parse?validation=true`, {
  method: 'POST',
  headers: {
    'Accept': 'application/json',
    'Content-Type': 'application/json',
  },
  body: bodyData
});

console.log(response, “res”)
const result = await response.json();
console.log(result, “check my result”);

if (response.ok) {
  return { valid: true, results: result };
} else {
  console.error('Validation failed:', result);
  return { valid: false, errors: result.errors || [] };
}

};
i am creating a custom jql function where i am accepting two arguments from user first will be jql and second could be hisa name of accountid so when i am checking for a singe jql function for eg project=xyz it validates and doenst give error but if i check for assignee=currentUser() for this it gives error and also if i use AND,OR to cobine two queries it gives me error i am still trying to figure out why

The validation query parameter accepts only these values instead true

2 Likes