Non c'è fortuna nell'aggiungere un problema tramite AJAX e l'API REST. Posso farlo funzionare con Postmen, sfortunatamente, non riesco a ottenerlo con una richiesta Ajax.Errore API JIRA Rest. Token non riconosciuto che crea un problema
Il JSON che creo va bene, anche la richiesta di post. L'issuetype è qualcosa che ho creato io stesso, l'uso di Bug dà lo stesso problema. Vedere l'oggetto JSON creato, il mio errore e il mio codice: JSON oggetto (si tratta di un frammento da console.log):
L'errore
0: "Token non riconosciuto 'fils5poet5 ': si aspettava 'null', 'true', 'false' o NaN↵ a [Fonte: org.apache.catalina.connector.CoyoteInputS[email protected]; linea: 1, colonna: 21]"
jira = {
fields : {
project : {
key : "CIC"
},
summary : "test",
description: "test",
issuetype : {
name : "Sandbox item"
}
}
};
console.log(jira); //Also see image at top of this post.
// Submit to Jira api
$.ajax({
type : "POST",
dataType : "JSON",
url : configuration.api_url,
beforeSend: function (xhr) {
xhr.setRequestHeader ("Authorization", "Basic ItsAWrap!(itworks...)"),
xhr.setRequestHeader ("Content-Type", "application/json");
},
data : jira,
success : (function(response) {
//Do something
}})