Skip to content

Instantly share code, notes, and snippets.

@JogoShugh
Created February 1, 2013 07:02
Show Gist options
  • Save JogoShugh/4689842 to your computer and use it in GitHub Desktop.
Save JogoShugh/4689842 to your computer and use it in GitHub Desktop.
Query the VersionOne API or Stories
var url = "http://eval.versionone.net/platformtest/rest-1.v1/Data/Story/1154";
var headers = { Authorization: "Basic " + btoa("admin:admin"), Accept: "haljson" };
var settings = { url: url, headers: headers, dataType: "json" };
$.ajax(settings).done(function(data) {
beautifulJson = JSON.stringify(data, null, 4);
$("body").html("<pre>" + beautifulJson + "</pre>");
}).fail(function(jqXHR) {
$("body").html(jqXHR.responseText);
});
{
"AssetType": "Story",
"AssetState": "64",
"Description": "Hello this is my sample story!",
"Name": "Tutorial Story",
"Reference": "",
"ToDo": "1",
"DetailEstimate": "",
"RequestedBy": "Danny Aldrich",
"Value": "",
"Order": "139",
"Estimate": "3",
"LastVersion": "",
"OriginalEstimate": "",
"Number": "S-01139",
"Benefits": "Some benefits listed here!!!",
"Timebox.Name": "",
"Customer.Name": "",
"Customer.Nickname": "",
"IdentifiedIn.Name": "",
"Team.Name": "",
"Super.Name": "",
"Super.Number": "",
"Scope.Name": "System (All Projects)",
"Status.Name": "",
"Category.Name": "",
"Risk.Name": "",
"Source.Name": "",
"Priority.Name": "",
"Parent.Name": "",
"Parent.Number": "",
"SecurityScope.Name": "System (All Projects)",
"SplitFrom.Name": "",
"SplitFrom.Number": "",
"CompletedInBuildRuns.Name": "",
"Owners.Name": "",
"Owners.Nickname": "",
"Ideas": "",
"_links": {
"self": {
"href": "/platformtest/rest-1.v1/Data/Story/1154",
"id": "Story:1154"
},
"Timebox": [],
"Customer": [],
"IdentifiedIn": [],
"Team": [],
"Super": [],
"Scope": [
{
"href": "/platformtest/rest-1.v1/Data/Scope/0",
"idref": "Scope:0"
}
],
"Status": [],
"Category": [],
"Risk": [],
"Source": [],
"Priority": [],
"Parent": [],
"SecurityScope": [
{
"href": "/platformtest/rest-1.v1/Data/Scope/0",
"idref": "Scope:0"
}
],
"SplitFrom": [],
"CompletedInBuildRuns": [],
"Owners": []
}
}
var url = "http://eval.versionone.net/platformtest/rest-1.v1/Data/Story/1154";
var headers = { Authorization: "Basic " + btoa("admin:admin") };
var settings = { url: url, headers: headers, dataType: "text" };
$.ajax(settings).done(function(data) {
$("body").text(data);
}).fail(function(jqXHR) {
$("body").html(jqXHR.responseText);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment