@ianRagudo Thank you for your response i tried to fix the api here is the function const validateJQLQueries = async (queries) => {
const bodyData = JSON.stringify({
queries : queries
})
const validation = “strict”
const response = await api.asUser().requestJira(route`/rest/api/3/jql/parse?validation=${validation}`, {
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 || [] };
}
};
when using this JQL project=forge-learning i get the results but if i add space between keywords and operator i get to see error in console 10:48:20.213 70fa9a94-142b-40e6-b2fe-16a87a279be4 project = forge-learning my query
INFO 10:48:20.214 70fa9a94-142b-40e6-b2fe-16a87a279be4 712020:22b5ce4f-196a-4316-9f35-a5a48788e32a id of user
INFO 10:48:21.044 70fa9a94-142b-40e6-b2fe-16a87a279be4 Response {
size: 0,
timeout: 0,
[Symbol(Body internals)]: {
body: PassThrough {
_readableState: [ReadableState],
_events: [Object: null prototype],
_eventsCount: 2,
_maxListeners: undefined,
_writableState: [WritableState],
allowHalfOpen: true,
[Symbol(kCapture)]: false,
[Symbol(kCallback)]: null
},
disturbed: false,
error: null
},
[Symbol(Response internals)]: {
url: ‘https://jira/rest/api/3/jql/parse?validation=strict’,
status: 400,
statusText: ‘Bad Request’,
headers: Headers { [Symbol(map)]: [Object: null prototype] },
counter: 0
}
} res
INFO 10:48:21.051 70fa9a94-142b-40e6-b2fe-16a87a279be4 {
errorMessages: [
‘Invalid request payload. Refer to the REST API documentation and try again.’
]
} check my result
ERROR 10:48:21.051 70fa9a94-142b-40e6-b2fe-16a87a279be4 Validation failed: {
errorMessages: [
‘Invalid request payload. Refer to the REST API documentation and try again.’
]
}
ERROR 10:48:21.052 70fa9a94-142b-40e6-b2fe-16a87a279be4 Invalid JQL query:
is my api still the issue? am i accepting the args array correctly this is how i am doing it const { clause } = args;
const jqlQuery = clause.arguments[0].trim();
const userId = clause.arguments[1];
console.log(jqlQuery, “my query”);
console.log(userId, “id of user”);