How To Query VersionOne REST API (XML)
by Jason Rose
JavaScript
var url = "https://login.microsoftonline.com/[email protected]&xml=1";
var headers = { Authorization: "Basic " + btoa("admin:admin"), Accept: "haljson" };
var storyDto = {
Description: prompt("Enter a description", "Changing description at time of " + $.now()),
Estimate: prompt("Enter an estimate of 1 to 5", "2")
};
var settings = {
url: url,
type: "POST",
data: JSON.stringify(storyDto),
dataType: "json",
contentType: "haljson",
headers: headers
};
$.ajax(settings).done(function(data) {
beautifulJson = JSON.stringify(data, null, 4);
$("body").html("<pre>" + beautifulJson + "</pre>");
}).fail(function(jqXHR) {
$("body").html(jqXHR.responseText);
});