Skip to main content
Enterprise Agile Planning icon with arrows

This post is from the CollabNet VersionOne blog and has not been updated since the original publish date.

Last Updated Feb 07, 2013 — Enterprise Agile Planning expert

How To Query the VersionOne REST Data API for User Stories in JSFiddle with jQuery, JSON, HTTP GET, and 9 Lines of Code

Enterprise Agile Planning

Developing Custom VersionOne Apps 101 Series Guide Last time, in Understand How and Why REST APIs Work // Demonstrated with the VersionOne Data API, you looked at the VersionOne REST API in action, using only your browser's address bar. Now you'll write code. At last. In this article, you will

  • Get familiar with the JSFiddle online editor
  • Use jQuery.ajax to issue a GET HTTP request to the VersionOne Data API

This exercise will take you through the first step toward our next goal of building a very rudimentary Story Editor using standard HTML and JavaScript. But first, we simply use GET. Remember Tim Berners/Lee's statement about the beginning of the web and how the HTTP protocol did just one thing well? Here it is again:

The first version of the protocol had only one method, namely GET, which would request a page from a server. The response from the server was always an HTML page. // HTTP article on Wikipedia

Our response will be a JSON document :) // JSON = JavaScript Object Notation, which is simple, structured data that the JavaScript language interpreter built/in to the browser understands. What you'll need

  • Google Chrome. While it should work, I have not tested this in other browsers, so if you run into any snags, please let me know in the comments

Get familiar with JSFiddle and jQuery's $.ajax function

Let's use the handy and free online JavaScript / HTML / CSS editor JSFiddle to query the VersionOne REST API:

  • Open a brand new window or tab in Chrome and navigate to http://www.JSFiddle.net
  • From the left side, under Choose Framework. It should have onLoad preselected (leave it this way)
  • Select the most recent version of jQuery
  • On the right, you'll see four panels: HTML, JavaScript, CSS, and Result
  • Type the following 9 lines of code into the JavaScript panel, then press Run

[gist id=4689842 file=gistfile1.js]

Expected JSON Output

After running it, you should see something like the following. The data is returned in the JavaScript Object Notation format (JSON). We'll explain more about JSON later, but just know that this data is also valid JavaScript executable code, and that is what makes JSON data very natural for web browsers to handle and parse. [gist id=4689842 file=gistfile2.json] Try the live JSFiddle

Try it again with XML as the result format

For illustration purposes, now just paste in the following code into JSFiddle and run it. This time, you'll get the raw XML format because we do not pass the Accept: "halsjon" request header. XML is the default data format the VersionOne Data API supports. [gist id=4689842 file=gistfile3.js] Try the Live JSFiddle

Next up

That was easy enough. Now, let's see how to change the data in How To Update a User Story with the VersionOne REST Data API in JSFiddle with jQuery, JSON, HTTP POST, and 20 Lines of Code.

More from the Blog

View more
Jul 05, 2022

How to bring external data to Digital.ai Agility

Enterprise Agile Planning
Data integrations occur every day Data and system integrations tend ...
Read More
Digital.ai Government Cloud
Apr 12, 2022

Digital.ai Government Cloud receives FedRAMP Authorization through sponsorship from the United States Department of Veterans Affairs

Enterprise Agile Planning
Flagship Digital.ai Agility solutions can effectively scale agile deve ...
Read More
Nov 22, 2021

What are the qualities of highly effective agile teams?

Enterprise Agile Planning
A team is the core unit of productivity in an agile organization. Wher ...
Read More
Nov 15, 2021

How an open-first attitude revolutionized government tech development

Enterprise Agile Planning
Public perception of government is often that it is slow-moving, reluc ...
Read More
Contact Us